×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
SELECT a.Fld1, a.Fld2,
CASE
WHEN b.Fld1 IS NULL THEN ''
ELSE 'X'
END
FROM TableA a
LEFT OUTER JOIN TableB b ON a.Fld1 = b.Fld1
Have fun!
Richard
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Michael Ryan
Sent: Thursday, June 20, 2013 11:49 AM
To: Midrange Systems Technical Discussion
Subject: SQL Exists for Flag
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!
--
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.