To better explain what I need please look at this table:
ID --- image
A1 --- a1_01.jpg
A1 --- a1_02.jpg
B7 --- b7_01.jpg
B7 --- b7_02.jpg
D3 --- D3_04.jpg
D3 --- D3_99.jpg
... (From A to Z)
Z9 --- Z9_12.jpg
Z9 --- Z9_13.jpg
Z9 --- Z9_20.jpg
Z9 --- Z9_99.jpg
...and so on
I need the results to be:
ID --- Image
A1 --- a1_01.jpg
B7 --- b7_01.jpg
D3 --- D3_04.jpg
...
Z9 --- Z9_12.jpg
...and so on
In MS-Access this is can be done with SELECT ID, First(image) AS 'Image' FROM Photos
How can I accomplish this in MYSQL?
Remember that this is a mockup table, to illustrate my problem. I have tons and tons of records. IT IS NOT a single (least/most) value!
===EDIT: 11/24/2012===
FINAL SQL CODE:
SELECT ID, Min(image) AS 'Image'
FROM Photos
GROUP BY ID
解决方案
As i may see
select ID, min(image)
from tbl
group by ID