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 |
Shanmugaraja
Starting Member
3 Posts |
Posted - 2010-01-24 : 10:15:33
|
Hi AllI am new to reporting service.I have a 2 tables likeTable1====adetdate atotchg btotchg ctotchg=====================================================================20/01/2010 00:50:00 7 15 020/01/2010 05:10:58 6 50 5Table2====adetdate atotchg btotchg ctotchg=====================================================================20/01/2010 00:50:00 5 89 1020/01/2010 05:10:58 9 52 9I want a report which will take the parameters from the same column adetdate which contains the date and time.If i select 2 dates form and to dates in the parameters, it should display the total charges.I am using the below queryDECLARE( @StartDate DATETIME, @ENDDate DATETIME,adetdate DATETIME)SELECT SUM(y.atotchg+y.btotchg+y.ctotchg)/100 AS Revenue, SUM(x.atotchg)/100 AS Acost FROM Table1 xJOIN Table2 yON x.adetdate = y.adetdateWHERE adetdate >= @StartDate AND adetdate <= @ENDDateIts not fetching any values.Please help me out.ThanksShanmugaraja |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-24 : 10:18:27
|
whats the datatype of adetdate field? i cant understand why you gave field name in declare above. also what values will you be passing for @StartDate and @ENDDate? |
|
|
Shanmugaraja
Starting Member
3 Posts |
Posted - 2010-01-24 : 10:23:16
|
HiThe datetype is DATETIME and values for the adetdate @startTime will be like 20/01/2010 00:00:00 and @endtime like 21/01/2010 23:59:59 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-24 : 10:25:53
|
quote: Originally posted by Shanmugaraja HiThe datetype is DATETIME and values for the adetdate @startTime will be like 20/01/2010 00:00:00 and @endtime like 21/01/2010 23:59:59
they dont seem to have a problem.b/w did you try some other value range and see if you get any data? |
|
|
Shanmugaraja
Starting Member
3 Posts |
Posted - 2010-01-24 : 10:48:01
|
HiIs the Query rite, which i have framed. |
|
|
|
|
|