SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
May 19, 2004, 10:58 #1
- Join Date
- Apr 2003
- Location
- Chicago, USA
- Posts
- 417
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Trying to get rid of certain rows here...
OK, say I have a result table that looks like this:
Code:1 Item 1084985159 Test 3 Item3 1084984893 Test2 2 Item2 1084984864 Test3 2 Item2 1084984849 Test4 1 Item 1084984821 Test5
Code:1 Item 1084985159 Test 3 Item3 1084984893 Test2 2 Item2 1084984864 Test3
Thanks for any assistance.
-
May 20, 2004, 12:57 #2
- Join Date
- Oct 2001
- Location
- New Delhi, India
- Posts
- 277
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try this ...
Code:SELECT DISTINCT item_field, number_field, test_field FROM table WHERE item_field LIKE 'Item%' GROUP BY item_field
-
May 22, 2004, 12:48 #3
- Join Date
- Apr 2003
- Location
- Chicago, USA
- Posts
- 417
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
OK, I guess I didn't describe the problem good enough. What I'm trying to say is that I have all of these left joins and all of this data in these tables. I'm trying to pick out the greatest number out of this one field in one of the joined tables and then delete results which contains a duplicate entry for one of the fields in the entire query. When I try to select that field using DISTINCT, it doesn't work. I think it has to do with the fact that I'm using the GROUP BY clause at the end of all of these joins (since I'm using MAX()). Any help appreciated.
-
May 22, 2004, 14:28 #4
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
what do you mean by "all of these left joins" and "delete results"?
Bookmarks