![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello I have this table: images id (int 19), user_id (int 19), creation_date (date), image (varchar 10) insert into images values(1, 1, '2010-01-01', 'img1'); insert into images values(2, 1, '2010-01-02', 'img2'); insert into images values(3, 2, '2010-01-01', 'img3'); I want to get rows where the user only shows up once. If I run: select * from images group by user_id then I get rows with the id:s 1 and 3. The thing is that for a specific user_id I need to get the row that was inserted most recently. The user_id 1 has been inserted twice. First time 2010-01-01, second time 2010-01-02. I need to retrive the row with the date 2010-01-02. I tried ordering by creation-date but this didnt help. It must be a clause I think. But I must confess I dont know wich one. Any advice? |
![]() |
| Thread Tools | |
| Display Modes | |
| |