[SQL] help on a function with exception

2012-03-14 Thread M. D.
Hi, I want to do a check on a column if other columns meet certain conditions. The program I'm working with allows to create additional columns on every 'object' - called extra data, but I have no control over the program. I want to enforce the values on this one extra data to be of type dat

[SQL] running totals with end of month line

2011-11-30 Thread M. D.
Hi everyone, I would like to create a query that does a running total for each account, but I also want to show a 'phantom' row that gives the end of month with the last day of the month as the transaction date. Here's a sample query: SELECT n.customer_id, n

[SQL] parsing audit table

2011-08-16 Thread M. D.
Hi everyone, I'm a bit lazy, or actually in a bit of a crunch. I added an audit recording a few months ago, but never really used it much, but today I'm seeing a bunch of suspicious activity by one user. Does someone have any function to quickly parse this data? I followed this: http://wik

[SQL] group by with sum and sum till max date

2011-07-05 Thread M. D.
This is a little hard to explain, and I'm not sure if it's possible, but here goes. This is my query: select year, month, (select number from account where account.account_id = view_account_change.account_id) as number, (select name from account where account.account_id = view_account_change.a