Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2006-04-03 : 06:14:07
|
| I have a problem ? Any suggestions would be appreciated !I have the following table with structures:ID Title Character PostDate1 Tit1 A 200602032 Tit2 B 20060201 3 Tit3 C 200602054 Tit4 D 200602095 Tit5 D 200602026 Tit6 A 200601097 Tit7 Y 200608018 Tit8 B 20060801 9 Tit9 Y 20060801 10 Tit10 Z 20060801 ..... n ... Z 20060801 My problems :I only want to select some of records with Character= A,B,C,D,E .. Zand order by PostDateThe output :1 Tit1 A 200602032 Tit2 B 20060201 3 Tit3 C 200602054 Tit4 D 20060209.....N TitN Z .......The "Character" Field with A To Z and not repeated !This means I only want to 26 records.Any One help me !!Thank you very much. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-03 : 06:24:55
|
[code]select t.*from ( select Character, min(ID) as min_id from table1 group by Character ) d inner join table1 t on d.Character = t.Character and d.min_id = t.ID[/code] KHChoice is an illusion, created between those with power, and those without. |
 |
|
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2006-04-03 : 06:55:43
|
quote: Originally posted by khtan
select t.*from ( select Character, min(ID) as min_id from table1 group by Character ) d inner join table1 t on d.Character = t.Character and d.min_id = t.ID KHChoice is an illusion, created between those with power, and those without.
Good Job !!Thank you very much ! |
 |
|
|
|
|
|