Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incremental values!!!

Status
Not open for further replies.

ADW

Programmer
Jun 21, 2001
50
GB
Anybody Help? What I want to do is return values for every 7 days. For example, I want to return all transaction information on a weekly basis. How can I increment my SQL(Transact) statement?

select distinct transaction_type, Total = count(all transaction_type), Total_Quantity = sum(all movement_quantity) from st_history
where transaction_type != 'ADJ'
and transaction_type != 'TRAN'
and transaction_type != 'SCRP'
and transaction_type != 'BINT'
and transaction_type != 'SRET'
and transaction_type != 'DESP'
and transaction_type != 'RINV'
and transaction_type != 'SALE'
and dated > '2000-07-01'

group by transaction_type
order by transaction_type
 
First of all, change the and to an or. You will never find a transaction_type equal to all of those values. Next, change the dated syntax to be between two date values. Then, change the group by and order by statements to dated, transaction_type.

This should return all tranactions for this time period, sorted by date then transaction_type.......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top