![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a sql query that does not provide the correct counts. select location.name as "location Name", count ( case when incident.location_type = 138 AND incident_detail.witnessed = TRUE then 1 else null end) as "Fall witnessed" from incident, incident_detail, location where location.id = incident.id Is it becasue the query is from mutlitple tables? You might be right there ... |
#3
| |||
| |||
|
|
I have a sql query that does not provide the correct counts. [...] count ( case when incident.location_type = 138 AND incident_detail.witnessed = TRUE then 1 else null end) [...] |
#4
| |||
| |||
|
|
"Bigjim" <bigjim.st... (AT) rogers (DOT) com> schreef in berichtnews:1169835949.275145.213640 (AT) q2g2000cwa (DOT) googlegroups.com...>I have a sql query that does not provide the correct counts. select location.name as "location Name", count ( case when incident.location_type = 138 AND incident_detail.witnessed = TRUE then 1 else null end) as "Fall witnessed" from incident, incident_detail, location where location.id = incident.id Is it becasue the query is from mutlitple tables?You might be right there ... adding ' and incident.id = incident_detail.id' may cure To avoid such unnoticed drop-outs of code, consider using explicite join syntax from incident join location on( incident.id = location.id ) join incident_detail on( incident.id = incident_detail.id ) HansH |
![]() |
| Thread Tools | |
| Display Modes | |
| |