SELECT * FROM table1 AS tw INNER JOIN (SELECT table2.inci_id FROM table2 WHERE table2.inci_id = '07000244 ' or table2.inci_id = '2007093878 ' or table2.parent_id = '07000244 ' or (LEN(table2.parent_id)>0 AND table2.parent_id = '2007093878 ')) qry1 ON tw.inci_id = qry1.inci_id WHERE canccode=' ' ORDER BY tw.inci_id, tw.vehnum
SELECT * FROM table3 as vh INNER JOIN (insert 1st Query Above Here) qry2 ON vh.vehi_id = qry2.vehi_idHowever, it returns an error message that "column 'inci_id' was specified multiple times for tbl2" which I do not get since the 1st qry is the only one specifying inci_id and it works fine when run alone.
SELECT * from table3 as vh inner join (SELECT * FROM table1 AS tw INNER JOIN (SELECT table2.inci_id FROM table2 WHERE table2.inci_id = '07000244 ' or table2.inci_id = '2007093878 ' or table2.parent_id = '07000244 ' or (LEN(table2.parent_id)>0 AND table2.parent_id = '2007093878 ')) qry1 ON tw.inci_id = qry1.inci_id WHERE canccode=' ') qry2 on vh.vehi_id = qry2.veh_idAm I missing something obvious, AGAIN?