Looks like the text isn't very clear here. There are a number of ways of doing it but I think you are probably wanting derived tables....*(this is sql server specific -- may work on other rdbms but I'm not guaranteeing it)SELECT t1.[key], t1.[column], t2.[column]FROM ( SELECT [key], [column] FROM Table1 WHERE [foo] = 'bar' ) AS t1 JOIN ( SELECT [key], [column] FROM Table2 WHERE [woo] = 'coo' ) AS t2 ON t2.[key] = t1.[key]WHERE <Further Predicate list here>
Note the alias (t1, t2) for the derived tables....This would be exactly the same as making a VIEW over the tables and then JOINING the two views together.ALL relation database products I can think of will actually parse this SQL into their own execution plans and may do something different.I'd bet that SQL Server will treat the above code identically toSELECT t1.[key], t1.[column], t2.[column]FROM Table1 AS t1 JOIN Table2 AS t2 ON t2.[Key] = t1.[Key]WHERE t1.[foo] = 'bar' AND t2.[woo] = 'coo'
Transact CharlieMsg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.
http://nosqlsolution.blogspot.co.uk/