Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member cinq's Avatar
    Join Date
    Jun 2003
    Posts
    18
    Member #
    1971
    Got a bunch of data stored in SQL tables.
    Essentially, modelIDs of a product, for eg:
    AA111/123, AA111/456, AB111/123, AC111/456 .... and so on.

    What i need is the query to which I can extract just the following info :

    AA111, AB111, AC111.

    Basically, everything before the "/" character of the modelID of the product, but yet without repetitions ( note in this eg, there are 2 instances of AA111 : AA111/123 and AA111/456 )

    Please help.
    Much appreciated

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    735
    Member #
    1935
    you could use the SELECT DISTINCT query and then use the split() function to show the data before the /.

  4. #3
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    Code:
    SELECT DISTINCT substring( modelID, 1, locate( "/", modelID ) - 1 ) FROM TABLE_NAME
    There and Back Again :Ogre:

  5. #4
    Junior Member cinq's Avatar
    Join Date
    Jun 2003
    Posts
    18
    Member #
    1971
    Thanks folks, never knew about the DISTINCT feature of SELECT

    Got it working now , woot


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:55 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com