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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-01-28 : 08:44:36
|
| John writes "I need to retrive the primary key for the rows returned from the following query.Here is my Table A {MyId (integer), Column1(String), Date1(date-time)}select max(Date1),column1from Awhere Date1 = todaygroup by column1I want to know if I can write a SQL query which can basically get me the MyId column for every row returned by the above query without having to use any programming logic. Can it be written in one single SQL query.ThanksJohn" |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-01-28 : 08:56:19
|
| select distinct myid from a inner join (select max(Date1) as Mdate,column1from Awhere Date1 = todaygroup by column1) bon a.date1=b.mdate and a.column1=b.column1HTH--------------------------------------------------------------Dont Tell God how big your Problem is , Tell the Problem how Big your God is |
 |
|
|
|
|
|