Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

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 June 6th, 2006, 09:34 AM
LucDenys LucDenys is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 1 LucDenys User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 18 sec
Reputation Power: 0
Problem witn select

I need the addresses from a database. The persons belong to different groups. The groups are identified by IS_ID. Some groups have to be joined though. For instance groups 2 and 3 should be joined. Tried to accomplish this using the following
SELECT
PERSONEEL.PS_NAAM,
PERSONEEL.PS_VOORNAAM,
PERSONEELADRES.PA_STRAAT,
PERSONEELADRES.PA_STRAATNR,
PERSONEELADRES.PA_STRAATBUS,
GEMEENTE.GM_POSTCODE,
GEMEENTE.GM_DEELGEMEENTE
FROM
PERSONEEL,PERSONEELADRES,GEMEENTE,DIENSTVERBAND,INSTELLING,SCHOOL
WHERE
PERSONEELADRES.PA_PERSONEEL_FK = PERSONEEL.PS_ID
AND PERSONEEL.PS_ID = DIENSTVERBAND.DV_PERSONEEL_FK
AND PERSONEELADRES.PA_GEMEENTE_FK = GEMEENTE.GM_ID
AND DIENSTVERBAND.DV_SCHOOL_FK = SCHOOL.SC_ID
AND SCHOOL.SC_ID = INSTELLING.IS_SCHOOL_FK
AND IS_ID IN (
SELECT
CASE
WHEN IS_ID = 2 THEN '2,3'
WHEN IS_ID = 3 THEN '2,3'
WHEN IS_ID = 4 THEN '4'
WHEN IS_ID = 5 THEN '5'
WHEN IS_ID = 7 THEN '7'
WHEN IS_ID = 10 THEN '10,11'
WHEN IS_ID = 11 THEN '10,11'
WHEN IS_ID = 12 THEN '12'
WHEN IS_ID = 14 THEN '14,15'
WHEN IS_ID = 15 THEN '14,15'
WHEN IS_ID = 17 THEN '17,18'
WHEN IS_ID = 18 THEN '17,18'
WHEN IS_ID = 21 THEN '21,22,23'
WHEN IS_ID = 22 THEN '21,22,23'
WHEN IS_ID = 23 THEN '21,22,23'
END)
In the final version IS_ID before the In has to be replaced with a parameter.
Now I only get the single values, ie 4, 5 and 7.
Can anyone help me to get this right.
Many thanks in advance.

Luc Denys

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Problem witn select


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 1 hosted by Hostway