Re: [Q] SQL question
Posted in 1995
>Is there a way for me to get a select statement to bring fields from two
>tables by a common select criteria?
>
>e.g
>Select lname, fname, status
>from contractors, visitors
>where status ="IN">
>I know this does not work. It gives me a cartesian product. I have been
Saqib
It seems to me that a UNION is what you are looking for, hence:
SELECT lname, fname, status
FROM contractors
WHERE status ="IN"
UNION
SELECT lname, fname, status
FROM visitors
WHERE status ="IN"
BTW, I would be *very* careful about using a word like "status" as a column
name...
HTH.
--
Cheers,
Billy
-----------------------------------------------------------------------------
INCLUDE "Disclaimer.4gh" -- my opinions are
INCLUDE "FlamesToDevNull.4gh" -- flamers, eat my shorts!
INCLUDE "CaveatEmptor.4gh" -- take my advice at your own risk
INCLUDE "ThirtySomething.4gh" -- header file for this class
-- Written by : Billy Wheeler, Date: today
-- Copyright (c) 1995, The West Solutions Group