What defines the income / expenditure to be on the same line ? Is it a date? For example: April 15th, 2009: Income: $500, Expense: $200 Also, is there always a match between income and expense on the same day? Example 2: May 1: Income $200, no expense or No income, $50 expense. This would determine how the SQL query is structured.