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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venkatesan
NA
16
6.8k
Plz Solve this sql Query..
Jun 21 2013 8:46 AM
1) My Table:
Query: select mcdesp,mcidno,mcopsts,hascode from machine
Table:
mcdesp
mcidno
mcopsts
hascode
A
A0001
URWT
####
A
A0001
GOOD
####
A
A0001
GOOD
####
B
A0002
URWP
####
B
A0002
URWP
####
C
A0003
GOOD
####
C
A0004
URWT
####
Here i'm generating my hashcode using this script
hascode = HASHBYTES('MD5', CAST(mcidno AS VARBINARY(MAX))+ CAST(mcdesp AS VARBINARY(MAX))+CAST(mcopsts AS VARBINARY(MAX)))
Note: Same Color represents Hascodes are same.
2) My Query and its output:
select mcdesp,count(distinct hascode)as TotalMachine from machine group by mcdesp
mcdesp
TotalMahine
A
2
B
1
C
2
Let This Tableas "Tbl_Main"
What is the Query for finding Good Machines from my "Tbl_Main"??
that is mcopsts='good'. based on Hascode.
I need a Result Like
mcdesp
GOOD
A
1
B
0
C
1
Reply
Answers (
3
)
sql query
what is table value parameters in SQL