If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MTD and YTD report

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-14-04, 10:13
scoot525 scoot525 is offline
Registered User
 
Join Date: Oct 2004
Posts: 2
Smile MTD and YTD report

I have a query problem that I would like some help on. I need to create a query from a transaction table. The table has ref(reference number), trd(date), trt(total), and trc(code). I can create a query that has MTD or YTD but not both at the same time. In order to get a true total I must also add up all of the totals for trc = "I" and subtract everything else. If anyone can help I would really appreciate it.


+-----------+------------+--------+-----+
| ref | trd | trt | trc |
+-----------+------------+--------+-----+
| 449181244 | 2004-10-01 | 54.26 | I |
| 449181245 | 2004-10-01 | 13.31 | I |
| 449181246 | 2004-10-01 | 25.72 | 0 |
| 449181247 | 2004-10-01 | 3.20 | I |
| 449181248 | 2004-10-01 | 16.99 | M |
| 449181248 | 2004-10-01 | 20.46 | I |
| 449181249 | 2004-10-01 | 11.57 | 0 |
+-----------+-------------+-------+----+
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On