Gossamer Forum
Home : General : Databases and SQL :

Tricky column on select

Quote Reply
Tricky column on select
I have a table that looks like this:

Code:
Name | Subject | Type | No.
---------------------------------
Abc Qwe T 2
Abc Qwe P 3
Abc Qwe P 3
Abc Rty T 1
...
I need to build an SQL SELECT statement that allows me to obain this result:
Code:
Name | Subject | No. T | No. P
-----------------------------------
Abc Qwe 2 6
Abc Rty 1 0
...
Is this possible?

I was thinking of something like:
Code:
SELECT Name, Subject, NoT, NoP
FROM table
WHERE NoT=(SELECT...) AND NoP=(SELECT...)
GROUP BY Name, Subject
Subject Author Views Date
Thread Tricky column on select hlc 7600 Feb 12, 2003, 7:09 AM
Thread Re: [hlc] Tricky column on select
Stealth 7450 Feb 12, 2003, 10:30 AM
Thread Re: [Stealth] Tricky column on select
hlc 7394 Feb 12, 2003, 10:45 AM
Post Re: [hlc] Tricky column on select
Stealth 7342 Feb 12, 2003, 11:12 AM
Thread Re: [hlc] Tricky column on select
Alex 7395 Feb 12, 2003, 11:42 AM
Post Re: [Alex] Tricky column on select
hlc 7288 Feb 13, 2003, 5:22 AM