Journal_T
- Basically this is the journal table with positive and negative values.
Fields are: id
, date
, ref
, description
, amount
, segment
, period
, year
.
I want to display this in two separate columns - debits
(containing positive values) and credits
(containing negative values). Following is the query I am using:
$qry = mysql_query("SELECT id, date, ref, description, SUM(amount),
segment, period, year
FROM Journal_T
GROUP BY segment, year, period, id") or die(mysql_error());