C
Carlos Durán Urenda
Hi
This SQL returns to me the last 10 records in a table, order by Id field
SELECT * FROM MyTable WHERE Id IN ( SELECT TOP 10 Id FROM Table
ORDER BY Id DESC) ORDER BY Id
But i need to get a similar result based in two o more id Fields
can I to do it with the EXISTS Statment?, I found this example...
SELECT * FROM suppliers WHERE EXISTS (select * from orders where
suppliers.supplier_id = orders.supplier_id);
But how can i do to apply it to the same table?
Can I use an Alias?
Can someone say to me how to do it?
Tnks
CD
This SQL returns to me the last 10 records in a table, order by Id field
SELECT * FROM MyTable WHERE Id IN ( SELECT TOP 10 Id FROM Table
ORDER BY Id DESC) ORDER BY Id
But i need to get a similar result based in two o more id Fields
can I to do it with the EXISTS Statment?, I found this example...
SELECT * FROM suppliers WHERE EXISTS (select * from orders where
suppliers.supplier_id = orders.supplier_id);
But how can i do to apply it to the same table?
Can I use an Alias?
Can someone say to me how to do it?
Tnks
CD