|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help needed with SQL
Goodday
I've got a question on SQL. About the following query. This query give the desired result but because i needed to group by [klacht].[actie] the results show more lines in the table then wanted. I would want to join the ones with the same [boekingnr](like the ones marked in red below) into one. Anyone know how to do this? SELECT [Boeking].[landkort], [klacht].[boekingnr], Count([Klacht].[klachtnr]) AS [aantal klachten], IIf([Klacht].[actie]=On,COUNT(klacht.actie),'-') AS [actie ondernomen] FROM Boeking INNER JOIN Klacht ON [Boeking].[boekingnr]=[Klacht].[boekingnr] WHERE [Boeking].[boekingnr]=[Klacht].[boekingnr] GROUP BY [Boeking].[landkort], [klacht].[boekingnr], [klacht].[actie]; landkort -boekingnr- aantal klachten- actie ondernomen DE 5 1 1 DE 5 1 - DE 10 1 - ES 2 1 1 ES 7 1 - ES 9 1 1 I 4 1 1 NL 1 1 1 Thanx.. |
|
#2
|
||||
|
||||
|
Can I just ask what RDBMS you're using? Also I'm not used to seeing all those '[' and ']' what are they for?
christo
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Help needed with SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|