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 |
|
Adam West
Constraint Violating Yak Guru
261 Posts |
Posted - 2009-07-27 : 16:53:11
|
| SELECT *FROM Vw_Details Where ReportMonth = @ReportMonth and (ReportYear = @ReportYear or ReportYear = @ReportYear-1)and CustName = @CustName ORder by ReportYearOrder by "UserCatLongDescr_CATS" |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-07-27 : 17:00:47
|
Well there are two ORDER BY clauses.. does this work? SELECT *FROM Vw_Details Where ReportMonth = @ReportMonth and (ReportYear = @ReportYear or ReportYear = @ReportYear-1) and CustName = @CustName ORDER BY ReportYear, UserCatLongDescr_CATS |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-07-27 : 17:01:40
|
Drop the double quotes. And don't use double ORDER BY.Separate them with comma.SELECT *FROM Vw_Details Where ReportMonth = @ReportMonthand ReportYear IN (@ReportYear, @ReportYear-1)and CustName = @CustNameORder by ReportYear, UserCatLongDescr_CATS N 56°04'39.26"E 12°55'05.63" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-07-27 : 17:02:01
|
 N 56°04'39.26"E 12°55'05.63" |
 |
|
|
sajeev4evr
Starting Member
5 Posts |
Posted - 2009-08-07 : 06:57:42
|
| Nice |
 |
|
|
|
|
|