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 2005 Forums
 Analysis Server and Reporting Services (2005)
 How to set 2 parameters from same column field

Author  Topic 

Shanmugaraja
Starting Member

3 Posts

Posted - 2010-01-24 : 10:15:33
Hi All

I am new to reporting service.

I have a 2 tables like

Table1
====
adetdate atotchg btotchg ctotchg
=====================================================================
20/01/2010 00:50:00 7 15 0
20/01/2010 05:10:58 6 50 5


Table2
====
adetdate atotchg btotchg ctotchg
=====================================================================
20/01/2010 00:50:00 5 89 10
20/01/2010 05:10:58 9 52 9

I 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 query

DECLARE
(
@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 x
JOIN Table2 y
ON x.adetdate = y.adetdate
WHERE adetdate >= @StartDate
AND adetdate <= @ENDDate


Its not fetching any values.

Please help me out.

Thanks
Shanmugaraja

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?
Go to Top of Page

Shanmugaraja
Starting Member

3 Posts

Posted - 2010-01-24 : 10:23:16
Hi

The 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
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-24 : 10:25:53
quote:
Originally posted by Shanmugaraja

Hi

The 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?
Go to Top of Page

Shanmugaraja
Starting Member

3 Posts

Posted - 2010-01-24 : 10:48:01
Hi

Is the Query rite, which i have framed.
Go to Top of Page
   

- Advertisement -