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 |
|
alex.haller
Starting Member
3 Posts |
Posted - 2009-08-07 : 13:08:14
|
| Hy, i have this select: SELECT SOURCE, COUNT(*) FROM tableWHERE SOURCE <>'%SD%'GROUP BY SOURCEORDER BY 2 DESCBut in the results, this collumn shows all entries with SD.And I want do select the last 30 days from today, for the select above.Somebody can help me???? |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-08-07 : 13:10:57
|
| your where clause should be:Source NOT LIKE '%SD%'Be One with the OptimizerTG |
 |
|
|
alex.haller
Starting Member
3 Posts |
Posted - 2009-08-07 : 13:21:22
|
| OH THANKS......AND COULD YOU HELP ME WITH ANOTHER ONE????I NEED TO SELECT THE LAST 30 DAYS FROM TODAY, I REALLY HAVE NO IDEA HOW TO DO THIS. |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-08-07 : 13:25:01
|
| where datediff(day, <yourDateColumn>, getdate()) between 0 and 30Be One with the OptimizerTG |
 |
|
|
alex.haller
Starting Member
3 Posts |
Posted - 2009-08-07 : 13:34:21
|
| ok, thanks a lot TG, it works... |
 |
|
|
|
|
|