Hi guys,
Here�s my SQL for you.
Table
Rome S
Rome D1
Rome D2
Rome D1
Geneva S
Geneva S
Geneva D1
Geneva D1
Tel-Aviv T1
Tel-Aviv T1
Tel-Aviv T1
Tel-Aviv D1
Tel-Aviv D1
I�m trying to count how many S, D and T are there (mind that there might be D1 and D2)
I tried this:
SELECT city, type, count(type) as totalS, count(distinct type) as totalD
FROM myTable
WHERE ID=213 AND type='S' or type='Double(1)'
GROUP BY city
But the result are not as I expected
It should be:
City/ total s/ total d/ total t
Rome 1 2 0
Geneva 2 1 0
Tel Aviv 0 1 1
thanks for any advise
Here�s my SQL for you.
Table
Rome S
Rome D1
Rome D2
Rome D1
Geneva S
Geneva S
Geneva D1
Geneva D1
Tel-Aviv T1
Tel-Aviv T1
Tel-Aviv T1
Tel-Aviv D1
Tel-Aviv D1
I�m trying to count how many S, D and T are there (mind that there might be D1 and D2)
I tried this:
SELECT city, type, count(type) as totalS, count(distinct type) as totalD
FROM myTable
WHERE ID=213 AND type='S' or type='Double(1)'
GROUP BY city
But the result are not as I expected
It should be:
City/ total s/ total d/ total t
Rome 1 2 0
Geneva 2 1 0
Tel Aviv 0 1 1
thanks for any advise