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 > Data Access, Manipulation & Batch Languages > ANSI SQL > SQL question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-03, 17:16
mrosier mrosier is offline
Registered User
 
Join Date: Sep 2003
Location: ATL, GA
Posts: 4
SQL question

I am not sure this is the place to ask a how-to question but here goes....
I am querying at database at work which is part of my first taste of offices after school..... I am searching through billing amounts and hours according to the criteria of date..... clients have been billed on separate dates, but I want to sum the hours and costs to clients of each date and display those sums as one record. I can only so far display each date with the costs to the client associated to them. so instead of listing the same client on multiple dates I want to list them once for those dates with the amounts associated summed together. Any hints on how to do this concerning code? Sorry I know this is probably not good enough at all to answer lol! any answers please email me
Reply With Quote
  #2 (permalink)  
Old 09-17-03, 14:40
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Exclamation

When posting a question, it is good practice to supply information about the operating system, database version, descriptions of the tables, sample of the source data and example of the expected results.

I assume you are asking how to 'pivot' a table, therefore for an Oracle database, you better Ask Tom:

http://asktom.oracle.com/pls/ask/f?p...3616928827525,
http://asktom.oracle.com/pls/ask/f?p...:766825833740,
http://asktom.oracle.com/pls/ask/f?p...:124812348063,
http://asktom.oracle.com/pls/ask/f?p...:988230525691,
http://asktom.oracle.com/pls/ask/f?p...:419593546543,


__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 09-17-03, 15:56
mrosier mrosier is offline
Registered User
 
Join Date: Sep 2003
Location: ATL, GA
Posts: 4
Access DB

My apologies, it is an Access DB and I am working with one table to do this. It lists clientid, date, hours, amount and other data I am not using for this. But since there is a range of dates I am using as criteria for the queries, of course it produces a record for each date that time was billed for each client. So as I said, client 123 is listed multiple times because there was time billed on multiple dates within the range criteria associated with date. I want to take all the listings, sum the hours and amounts, and just list it once in the results. I want the date and its critieria to be nothing more than a range to search instead of a record listing.
Reply With Quote
  #4 (permalink)  
Old 09-17-03, 16:11
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Exclamation

Not necesary to apologize, we all learn a little every day.

For a solution to your problem, look under 'Pivot Table' in the MS Access help.

I know how to do it in Excel, but never done it in Access.

Good luck,

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #5 (permalink)  
Old 09-17-03, 19:05
mrosier mrosier is offline
Registered User
 
Join Date: Sep 2003
Location: ATL, GA
Posts: 4
thanks!

Thanks, man! I will check that out definitely. But can you tell me how you did it in Excel? If it is a function I mean. I bet it is similar to that in SQL. Or at least the logic is pretty close. Thanks again man! I'll leave ya be past this, sorry heheheh!
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