Hi all,

I have 3 tables:

tbl_users

id | user
-----------------------
 1 | charles

tbl_ins

id | in     |date            |user
____________________________________
1  | 100.00 |timestamp       |1
2  |  50.00 |timestamp       |1

tbl_outs

id | out    |date            |user
____________________________________
1  |  20.00 |timestamp       |1
2  |  40.00 |timestamp       |1


I want this to work like a checkbook register, where by date, I display the ins and outs (one per line) with a running balance.


Here is my query (I know it does not have the balance, but I can work that part out).

SELECT tbl_users.id, tbl_ins.in, tbl_outs.out
FROM tbl_users
LEFT JOIN tbl_ins ON tbl_ins.user = tbl_users.id
LEFT JOIN tbl_outs ON tbl_outs.user = tbl_users.id
WHERE tbl_users.id = 1


How do I get it to show me as I like, one in and one out per line, rather then an in for every out and vice-versa?



My other thought was to have one table with positive and negative values in an AMOUNT field...


Thanks,
Charles


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to