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 |
ascipio
Starting Member
1 Post |
Posted - 2011-05-04 : 08:29:29
|
ID mobileno dateofregistration registrationstate44 1674174925 2011-04-18 10:17:30.670 045 1677864168 2011-04-18 10:20:22.450 146 1677864161 2011-04-18 20:47:35.293 047 1674174925 2011-04-19 09:28:55.200 148 1674174925 2011-04-19 09:28:56.200 049 1674174925 2011-04-19 09:28:57.200 150 1674174925 2011-04-18 10:17:30.670 051 1677864168 2011-04-18 10:20:22.450 152 1677864161 2011-04-20 20:47:35.293 053 1674174925 2011-04-22 09:28:55.200 154 1674174925 2011-04-28 09:28:56.200 055 1674174925 2011-05-28 09:28:57.200 1my problem is how to count the row with the following conditions1. registrationstate=1 and datediff(day,dateofregistration)>30 for the individual mobile no.Here the result will be 1
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-05-04 : 08:37:56
|
select count(*)from yourTablewhere registrationstate = 1and datediff(day,dateofregistration,DATETOCOMPAREHERE) > 30Everyday I learn something that somebody else already knew |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-04 : 10:32:32
|
quote: Originally posted by ascipio ID mobileno dateofregistration registrationstate44 1674174925 2011-04-18 10:17:30.670 045 1677864168 2011-04-18 10:20:22.450 146 1677864161 2011-04-18 20:47:35.293 047 1674174925 2011-04-19 09:28:55.200 148 1674174925 2011-04-19 09:28:56.200 049 1674174925 2011-04-19 09:28:57.200 150 1674174925 2011-04-18 10:17:30.670 051 1677864168 2011-04-18 10:20:22.450 152 1677864161 2011-04-20 20:47:35.293 053 1674174925 2011-04-22 09:28:55.200 154 1674174925 2011-04-28 09:28:56.200 055 1674174925 2011-05-28 09:28:57.200 1my problem is how to count the row with the following conditions1. registrationstate=1 and datediff(day,dateofregistration)>30 for the individual mobile no.Here the result will be 1
Please show us the record row that will be counted on this conditions because I can't see a row older than 30 days... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|