add new records to existing query, nested join?
Posted on 2007-08-02
Given the integer 123, I have some asp.net code that generates the following query:
SELECT * FROM et_objects
WHERE (master_object_id = 'i123')
ORDER BY CONVERT(int, RIGHT(object_id, LEN(object_id) - 1))
I now need the query to return exactly what it currently returns *plus* any rows from the table 'vt_accounting_notes' where vt_accounting_notes.vt_folder_id == the original integer (123). The tables have almost no similarities, and whatever makes for the simplest query is fine as a result (I'm guessing NULL's in the et_objects fields for rows from vt_accounting_notes, and NULL's in the vt_accounting_notes fields for rows from et_objects). It does not matter where the vt_accounting_notes end up sorted in the final list, as long as the ORDER BY for et_objects is preserved.
Thanks for any help.