If you are wanting a checkbook like display then each entry is either a 
debit or credit and each is on its own line.
Your query will display this. I would add an ifnull to display a zero 
when the the debit/credit is null.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 3/2/04, 10:50:15 AM, charles kline <[EMAIL PROTECTED]> wrote 
regarding Need help with ledger type query:


> 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]

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

Reply via email to