![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi there, i don't know if i'm in right Ng, but i'd ask you something bout access database query. |
|
I have got a db with a table so ID ITALY (boolean) GREECE boolean Ok. I have to create a query to calculate how many records are true for ITALY and the same for Greece. I have already written a double query that is this: select count(Italy) as IT from XXX where Italy = True and the same for greece. Can someone tell me how write this query one time for both? Thanks (i hope to be clear!) |
#3
| |||
| |||
|
|
Hi there, i don't know if i'm in right Ng, but i'd ask you something bout access database query. |
|
I have got a db with a table so ID ITALY (boolean) GREECE boolean Ok. I have to create a query to calculate how many records are true for ITALY and the same for Greece. |
#4
| |||
| |||
|
|
i don't know if i'm in right Ng, but i'd ask you something bout access database query. I have got a db with a table so ID ITALY (boolean) GREECE boolean Ok. I have to create a query to calculate how many records are true for ITALY and the same for Greece. I have already written a double query that is this: select count(Italy) as IT from XXX where Italy = True and the same for greece. Can someone tell me how write this query one time for both? |
#5
| |||
| |||
|
|
El 04/03/2011 16:38, Giovanni Militano escribió/wrote: i don't know if i'm in right Ng, but i'd ask you something bout access database query. I have got a db with a table so ID ITALY (boolean) GREECE boolean Ok. I have to create a query to calculate how many records are true for ITALY and the same for Greece. I have already written a double query that is this: select count(Italy) as IT from XXX where Italy = True and the same for greece. Can someone tell me how write this query one time for both? In MySQL you can just use a CASE statement, supposing you have TINYINT(1) columns: SELECT COUNT(CASE italy WHEN TRUE THEN 1 END) AS num_true_italy, COUNT(CASE greece WHEN TRUE THEN 1 END) AS num_true_greece FROM xxx |
![]() |
| Thread Tools | |
| Display Modes | |
| |