SQL is definitely not my strong point. I need to add a column to an existing select statement that looks like this:
--------------
SELECT A.ID, A.SCHEDSTARTDATE, A.DBID, B.NAME, ...about 12 more columns all from the A table...
FROM FirstTable A, SecondTable B
WHERE A.STATE = B.ID
-------------
I have to join that with a third table and get just one column. Im guessing this will be a LEFT OUTER JOIN as the additional column is only present on some of the corresponding A rows.
So I thought it would look like this:
---------------
SELECT A.ID, A.SCHEDSTARTDATE, A.DBID, B.NAME, ...those 12 columns all from A..., C.NAME_HOST
FROM SecondTable B,
(FirstTable A
LEFT OUTER JOIN ThirdTable C
ON A.DBID = C.DBID)
WHERE A.STATE = B.ID
---------------
That doesnt return an error but its grabbing tons of documents, way more than original so obviously its wrong. Is the "WHERE A.STATE = B.ID" just completely off?
Any help would be greatly appreciated