Results 1 to 4 of 4

Thread: how can i select one only to display if there's same thing more then one in table.

  1. #1
    Join Date
    Jun 2003
    Location
    Houston
    Posts
    27

    Question how can i select one only to display if there's same thing more then one in table.

    Hi ..
    i am SqL beginner. i having trouble output what i want from table.
    table contain 3 columns
    ________________________________
    |(names)|(item)|(location)|
    1.| Jimmy | pizza| TX |
    2.| Joe | ball | CA |
    3.| Joe | ball | WA |
    4.| Jim | shoes| AZ |
    ________________________________

    i try to select all records out from this table. but column 2 and 3 contain same information in names and item only different is location. how can distinct one of them?? and display like the below, please advise.

    |(names)|(item)|
    1.| Jimmy | pizza|
    2.| Joe | ball |
    3.| Jim | shoes|
    ________________________________

  2. #2
    Join Date
    Mar 2003
    Posts
    383
    You might use group by or distinct, either will solve your problem.
    -D

  3. #3
    Join Date
    Jun 2003
    Location
    Houston
    Posts
    27
    thanks . i only wants to show one if the names and item are the same. but i still wants to show all of them if the names is the same but item is different. or item is same and name is different. and if use distinct and group by, will only show one instead of 2??

  4. #4
    Join Date
    Mar 2003
    Posts
    383
    yes, it will only show one instance of name and item if you use group by name, item;
    -D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •