Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- How to query Sub-queries in same table.


ashish21cool - 10:28 am on Apr 19, 2008 (gmt 0)


First of all you dont need to add t1,t2. We name the tables as t1,t2....if there are more then 1 table.
try removing t1 and t2 and then fire the query.

SELECT * FROM transactions WHERE TotalAmount < (SELECT SUM(TotalAmount) FROM transactions WHERE TransactID = TransactRefID) ORDER BY ActualDate DESC

Let me know if it works or not


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/3629448.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com