Click here to Skip to main content
15,891,846 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all,
SQL
SELECT GEINFO_Routing_Party,COUNT((GEINFO_Routing_Party)) as routeCount,Trailer_Type_ID,count(Trailer_Type_ID) as cntTrailer,job_type,COUNT(job_type) as cntJob,Size,COUNT(Size) as cntSize
FROM MDT_JOB_MASTER_TABLE j
JOIN MDT_JOB_DETAILS_TABLE jd
ON  j.JOB_Number = jd.JOB_Number 
JOIN MDT_JOB_DETAILS_ASSIGN_TRACK_TABLE jt
ON jd.JOB_ORDER_DETAILS_NO = jt.JOB_ORDER_DETAILS_ID 
WHERE jt.MDT_Function_Code='0108' and jd.JOB_TYPE_ACTIVITY='DEL' and j.GEINFO_Routing_Party=1036 and jt.Job_LastStatus_Date_Time between '2014-10-15 00:00:00' and '2014-10-15 23:00:00'
group by GEINFO_Routing_Party ,Trailer_Type_ID,job_type,Size

here is the o/p while running
GEINFO_Routing_Party   routeCount      Trailer_Type_ID  cntTrailer job_type   Size   cntSize 
1036                   1                t1              1           export    20     1
1036                   2                t2              2           export    40     2
1036                   6                t3              6           Import    20     6
1036                   1                t4              1           Import    20     1
but i need o/p as
Trailer_Type_ID job_type
t1 t2 export import
t1count t2count size size
20 40 20 40
count count count count

i want like the above in ssrs report
pls advice

that is like count no.of trailertype where trailertype_id=t1
that is like count no.of trailertype where trailertype_id=t2
that is like count no.of size=20 where job_type=export
that is like count no.of size=40 where job_type=export
that is like count no.of size=20 where job_type=Import
that is like count no.of size=40 where job_type=Import
by grouping one routing party that 1036
eg:
count no.of trailertype where trailertype_id=t1 =9
count no.of trailertype where trailertype_id=t1 =1
count no.of size=20 where job_type=export =6
count no.of size=40 where job_type=export=1
count no.of size=20 where job_type=Import=2
count no.of size=40 where job_type=Import=1
all into one row
Posted
Updated 16-Oct-14 1:03am
v4
Comments
Shweta N Mishra 16-Oct-14 9:59am    
Not getting you question, Can you write the output which you are expecting and do not see the sort clause i.e. Order by clause in your query, I guess you can use that to sort your output the way you desire
Shweta N Mishra 16-Oct-14 10:03am    
Hi Maciej Los,

Thanks updated it in comments. Was suppose to do it there only but by mistake updated solution box.
Maciej Los 16-Oct-14 10:55am    
;)You're very welcome
;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900