1. Need Help With Pivot/Cross-Tab Query Please/ **Dates Are Not Fixed**
2. Need Help With Pivot/Cross-Tab Query Please
I've been writing (and learning from books, web articles, newsgroups,
etc..) T-SQL for SQL Server 2K for several years now, and have not found
a way to run basic queries that return pivot-like (or Cross-Tab like)
results. Here is a simple example of what I would like to do, but the
solution eludes me. I want to get the sales figures for each store,
over a 7-day period, and have the results displayed with the STORE in
rows, and the individual dates in columns. Here's the basic query:
SELECT SUM(sales_amount) as SumOfSales,
store_num,
sales_date
FROM Sales_Table
WHERE sales_date BETWEEN '05-01-2004' and '05-07-2004'
GROUP BY store_num, sales_date
ORDER BY store_num
Need the query to return results like this:
STORE May01 May02 May03 May04 May05 , etc..
0125 $2,344 $3,221 $1,044 $ 934 $ 788 , etc..
0127 $2,114 $5,122 $1,554 $1,222 $ 403 , etc..
0129 $4,344 $3,313 $1,223 $1,554 $1,223, etc..
I would greatly appreciate any help with how to do this. You wouldn't
believe how hard it is to find an example ANYWHERE, of how to do
something like this. I think if someone could please help me with the
basics, I could figure out the rest, such as adding grand totals to the
bottom, and getting the column headers to display the correct
dates/formats, etc..
I would be extremely grateful for any advice, or help with this.
jj
3. Moving Access Cross Tab Query to SQL Cross Tab
7. Cross-tab experts, please help!!!!
8. Can somebody help me with this cross tab query?
9. dynamic cross tab without aggregation? PLEASE help
10. Please help with query-syntax [query fails]
11. excel automation, cross tab query, parameterized queries
12. Expression Error on Parameter Query with link to Cross Tab Query
13. How can I make a cross-tab query a make-table query
14. cross tab query to show all fields in a query
15. cross tab query and select query