Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 2 of 2 total |
Assistance with SQL Statement |
Mon, Jan 30 2006 10:13 AM | Permanent Link |
"Scott Martin" | I have the following SELECT that loads the clients if they are in any of the list items.
How would I re-write this to display if they exist in all 3 only? Subselect? By chance, I am using SimpleQuery to allow users to create this Statement. Anyone have experience on how to create what I mentioned above using the SQ Builder? SELECT C.ClientID, C.DisplayName FROM CLIENTS C LEFT OUTER JOIN ClientRolodex CR ON (C.ClientID=CR.ClientID) INNER JOIN Rolodex R ON (CR.RolodexID=R.RolodexID) WHERE ( UPPER(R.Description) in ('DRIP','ISP','REP PROSPECT') ) Regards, Scott |
Tue, Jan 31 2006 7:35 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Scott,
<< How would I re-write this to display if they exist in all 3 only? Subselect? >> Actually INTERSECT should do the trick: SELECT C.ClientID, C.DisplayName FROM CLIENTS C LEFT OUTER JOIN ClientRolodex CR ON (C.ClientID=CR.ClientID) INNER JOIN Rolodex R ON (CR.RolodexID=R.RolodexID) WHERE UPPER(R.Description)='DRIP' INTERSECT SELECT C.ClientID, C.DisplayName FROM CLIENTS C LEFT OUTER JOIN ClientRolodex CR ON (C.ClientID=CR.ClientID) INNER JOIN Rolodex R ON (CR.RolodexID=R.RolodexID) WHERE UPPER(R.Description)='ISP' INTERSECT SELECT C.ClientID, C.DisplayName FROM CLIENTS C LEFT OUTER JOIN ClientRolodex CR ON (C.ClientID=CR.ClientID) INNER JOIN Rolodex R ON (CR.RolodexID=R.RolodexID) WHERE UPPER(R.Description)='PROSPECT' That should give you only the clients that exist in all 3 sets. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |