Help Needed to write Query

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Help Needed to write Query

 
0
  #1
Mar 12th, 2008
Here is data

EnqSrNo
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20


QTypeCode
1
1
2
2
2
2
3
3
4
4
4
5
5
5
5
5
5
5
1
1
2
2
2
2
3
3
4
4
4
5
5
5
5
5
5
5
1
1
2
2
2
2
3
3
4
4
4
5
5
5
5
5
5
5
1
1
2
2
2
2
3
3
4
4
4
5
5
5
5
5
5
5
1
1
2
2
2
2
3
3
4
4
4
5
5
5
5
5
5
5

I want Count of EnqSrno where QTypeCode is 1
this is 5 but its showing 10

I tried as -
SELECT DISTINCT COUNT(EnqSrNo) AS COUNT
FROM Table1
WHERE (QTypeCode = 1)

PLz help.
Accept Challenges and Enjoy Coding... :)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 440
Reputation: Sulley's Boo will become famous soon enough Sulley's Boo will become famous soon enough 
Solved Threads: 10
Sulley's Boo's Avatar
Sulley's Boo Sulley's Boo is offline Offline
Posting Pro in Training

Re: Help Needed to write Query

 
0
  #2
Mar 12th, 2008
EnqSrNo	QTypeCode
9	1
9	1
9	2
9	2
9	2
9	2
9	3
9	3
9	4
9	4
9	4
9	5
9	5
9	5
9	5
9	5
9	5
9	5
8	1
8	1
8	2
8	2
8	2
8	2
8	3
8	3
8	4
8	4
8	4
8	5
8	5
8	5
8	5
8	5
8	5
8	5
11	1
11	1
11	2
11	2
11	2
11	2
11	3
11	3
11	4
11	4
11	4
11	5
11	5
11	5
11	5
11	5
11	5
11	5
13	1
13	1
13	2
13	2
13	2
13	2
13	3
13	3
13	4
13	4
13	4
13	5
13	5
13	5
13	5
13	5
13	5
13	5
20	1
20	1
20	2
20	2
20	2
20	2
20	3
20	3
20	4
20	4
20	4
20	5
20	5
20	5
20	5
20	5
20	5
20	5


I find them 10 too
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Help Needed to write Query

 
0
  #3
Mar 12th, 2008
Hi Sulley's Boo
Ya they are 10. but only need to count Distinct EnqSrNo against QTypeCode.
Thanks for reply.
Accept Challenges and Enjoy Coding... :)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 440
Reputation: Sulley's Boo will become famous soon enough Sulley's Boo will become famous soon enough 
Solved Threads: 10
Sulley's Boo's Avatar
Sulley's Boo Sulley's Boo is offline Offline
Posting Pro in Training

Re: Help Needed to write Query

 
0
  #4
Mar 12th, 2008
  1. SELECT count(DISTINCT(EnqSrNo)) FROM table_name
  2. WHERE QTypeCode=1;
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Help Needed to write Query

 
0
  #5
Mar 12th, 2008
HI Sulley's Boo
Hey Gr8. Its giving exact result i want. Thanks a lot.
Have a nice day.
If you dont mind can u do one more favor. I have posted one moer thread in asp.net. Where i put my Logic but i am unable to get that in code.

Please see if your are Interested.
Thanks a Lot again.......

Have a nice time.
Last edited by sbv; Mar 12th, 2008 at 4:33 am.
Accept Challenges and Enjoy Coding... :)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 440
Reputation: Sulley's Boo will become famous soon enough Sulley's Boo will become famous soon enough 
Solved Threads: 10
Sulley's Boo's Avatar
Sulley's Boo Sulley's Boo is offline Offline
Posting Pro in Training

Re: Help Needed to write Query

 
0
  #6
Mar 12th, 2008
lol, OK, i'll try
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Help Needed to write Query

 
0
  #7
Mar 12th, 2008
Thanks

Here is the link for my thread.
http://www.daniweb.com/forums/thread113457.html
Last edited by sbv; Mar 12th, 2008 at 4:44 am.
Accept Challenges and Enjoy Coding... :)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MS SQL Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC