TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
SQL Group With Group Total
Ashish Srivastava
Mar 22
2016
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
SELECT
isnull
(WO_status,0)
as
WO_status,
(
case
when
MwO.WO_status=1
then
'Open'
when
MwO.WO_status=2
then
'Close'
when
MWO.WO_status=3
Then
'Short Close'
when
MwO.WO_status=4
then
'Cancel'
else
'Total'
end
)
as
statusR,
count
(*)
as
countValue
FROM
M_WorkOrder MwO
inner
join
M_WorkorderDetails MwOd
on
MwO.WOID=MwOd.WOD_WOID
INNER
join
BILL_KEYWORD BK
on
BK.id=MwOd.WOD_KEYID
INNER
join
billing_from bf
on
bf.id=MwO.WO_CID
where
(MwOd.WOD_CUserID=15
or
15 =0 )
group
by
WO_status
WITH
ROLLUP
Group Total
SQL
SQL Group