Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross Tab / PIVOTTABLE help needed

Status
Not open for further replies.

KH75

Programmer
Jun 1, 2010
42
CA
select
CONVERT(VARCHAR(2), B.BILLDATE,101 ) BILLDATE,
B.BILLAMT , b.sourceord , taro.client_id
from [billing] as b with (nolock)
inner join [orders] as srco with (nolock) on (b.sourceord = srco.order_id)
inner join [funders] as fs on (srco.funder_id = fs.funder_id)
inner join [orders] as taro with (nolock) on (b.targetord = taro.order_id)
inner join [funders] as ft on (taro.funder_id = ft.funder_id)
inner join [clients] as c with (nolock) on (c.client_id = b.client_id)
WHERE FS.CODE <> FT.CODE
AND b.billdate >= @dt_StartDate AND b.billdate < @dt_EndDate_RPT
) DATATABLE
PIVOT
(
SUM(BILLAMT)
FOR BILLDATE
IN ([01],[02],[03],[04], [05], [06],[07],[08],[09],[10],[11],[12])
) PIVOTTABLE




Hi

I need a help about PIVOTTABLE. It is a quarter wise report but the quater is not fixed. User can select any 3 months. I don't want to use
([01],[02],[03],[04], [05], [06],[07],[08],[09],[10],[11],[12])

I want to use (Month1, Month2, Month3) means user select any 3 months but the result comes in (Month1, Month2, Month3)

My english is not good sorry about

Thanks


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top