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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 nested query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-04 : 13:55:18
Lady writes "Hi!!
I have table like this:
stateid logid(+) recorddate(now)
1 123
2 124
2 125
3 126
4 127
4 128
5 129
5 130
.........

I need get only this records, that have been changed :
1 123
2 124
3 126
4 127
5 129

i think, i have to use nested query, but i can't get true result

help me please..."

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-03-04 : 15:14:51
quote:
I need get only this records, that have been changed :



How do you know which ones have been changed? It looks like you have a date field defined (recorddate) but no sample data for that column provided. Are you looking for all records that have a recorddate >= some selected date value? Then that would be a simple WHERE clause. Or how else do you know which records "have been changed"?

------------------------
GENERAL-ly speaking...
Go to Top of Page

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2002-03-04 : 16:03:18
if you just want to know which records have been changed then run a distinct query. if you need logid you are going to have to group by stateid and then use the max(recorddate) to get the logid as well. Otherwise if you are looking for any records that have changed after a certain date then you include a where clause on with your distinct query.

Go to Top of Page
   

- Advertisement -