|
Posted by John Bokma on 03/21/06 05:13
"Stu" <stuart.ainsworth@gmail.com> wrote:
> It would help if you posted DDL and some sample data, but it sounds
> like you simply need to do a dual join on your second table using an
> alias, eg:
>
> SELECT a.*, b1.*, b2.*
> FROM tableA a JOIN TableB b1 ON a.ID = b1.ID
> JOIN TableB b2 ON aID2 = b2.ID
which gives me way too many rows :-) (or I did something very stupid)
I want for each result in a a single row, with each ID (and ID2) in TableB
resolved to an actual value.
SELECT ..., ( SELECT b.value FROM b WHERE a.ID = b.ID )
FROM a, b
WHERE a.ID2 = b.ID
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Navigation:
[Reply to this message]
|