![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Feb 2012
Posts: 2
Rep Power: 0
![]() |
[split] database
So I know this is a pretty dumb question, however (as the rather lengthily title says) I would like to know how do the following:
I have a table like this: ID Foo Bar Blagh ---------------- 1 10 20 30 2 10 5 1 3 20 50 40 4 20 75 12 I want to group by Foo, then pull out rows with minimum Bar, i.e. I want the following: ID Foo Bar Blagh ---------------- 2 10 5 1 3 20 50 40 I can't for the life of me work out the correct SQL to retrieve this. I want something like: SELECT ID, Foo, Bar, Blagh FROM Table GROUP BY Foo HAVING(MIN(Bar)) However this clearly doesn't work as that is completely invalid HAVING syntax and ID, Foo, Bar and Blagh are not aggregated. What am I doing wrong? |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Database Connection With PHP | kvdhanush | PHP | 0 | Feb 3rd, 2011 6:33 AM |
| VB.net and Access database integration | 47states | Visual Basic .NET | 4 | Jan 21st, 2011 11:09 PM |
| Storing BLOBs in a database - problem | jonyzz | Other Programming Languages | 8 | Jan 31st, 2007 4:38 AM |
| Using ODBC to connect to a remote database in a C program | bigi | C++ | 1 | Mar 8th, 2005 3:19 PM |