Article:
 |
|
SQL Subqueries
|
| Subject: |
|
Subqueries question - multiple conditions |
| Date: |
|
2005-01-26 01:24:57 |
| From: |
|
S-P-A-R-K
|
|
|
|
Hi,
I'd trying to make a grouped query that returns a count of unique values but where I have 2 boolean parameters:
For example - I have an "ID" column, and another boolean column named uType of 1 and 2.
I want to display the count of unique IDs of the 2 kinds (1,2) in 2 different columns.
The table has these fields:
ID | uType("1" or "2")
The result is sort of this:
ID Unique 1 Unique 2
6454 4 3
9788 9 7
9977 5 5
101 8 6
I only can show it in 2 queries and I need to make it one....
SELECT ID, COUNT(DISTINCT ID) AS UniqueID FROM MyTable WHERE uType = 1 GROUP BY ID
Thanks in advance!!!
|
Showing messages 1 through 5 of 5.
-
Subqueries question - multiple conditions
2006-12-10 21:24:50
chandu_sql
[Reply | View]
-
Subqueries question - multiple conditions
2007-07-05 16:19:21
Poon
[Reply | View]
-
Subqueries question - multiple conditions
2007-07-05 16:16:26
Poon
[Reply | View]
-
Subqueries question - multiple conditions
2007-07-05 16:14:19
Poon
[Reply | View]
-
Subqueries question - multiple conditions
2005-03-07 07:37:33
edsel99
[Reply | View]