Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 6th, 2003, 04:18 PM
Sorceress Sorceress is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 1 Sorceress User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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..

Reply With Quote
  #2  
Old November 8th, 2003, 02:58 PM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,297 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 1 h 9 m 17 sec
Reputation Power: 104
Send a message via ICQ to christo Send a message via Yahoo to christo
Can I just ask what RDBMS you're using? Also I'm not used to seeing all those '[' and ']' what are they for?

christo

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Help needed with SQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway