|
Left outer JOIN, I think.
select tablea.fld1, tablea.fld2, case when TableB.fld1 is null then ' '
else 'X' end from tablea join tableb on tablea.fld1 = tableb.fld1
Check the syntax of the CASE - I'm doing this from memory.
HTHAW (hope this helps and works)
Vern
----- Original Message -----
Here's what I want to do...TableA has 4 columns. TableB shares a key value
with TableA. I want to produce this output in a select statement (to be
used from PHP fwiw):
TableA.Fld1 TableA.Fld2 'X' (if TableA.Fld1 is in TableB).
I've been trying combinations of a CTE, CASE, and exists, but I can't get
this to work. I'd like:
A1 A2
A3 A4 X
A5 A6 X
A7 A8
IOW, I want the values for TableA to show up, and an X if the corresponding
key value is in TableB. This has to be easier than I'm making it out to be.
Thanks!
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.