LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default SQL Query Quandry

Hi All

I know I've got to post my schema, etc, but I think its more of a logic
thing than table-specific.

If you can imagine how an Excel pivot table would display it, I want all of
my sales people listed down the left hand side of my report, all my stock
categories listed along the top of my report and then for each value that
these 'axis's cover I want the sum of my qty sold field.

Getting this on an ASP page is my problem, but if I can get the desired
result in an Excel pivot table then I will be happy to continue the rest.

My basic 4 data fields are SALESPERSON, STOCKCAT, QTYSOLD and DATESOLD (the
last one being because I want to offer the user the ability to enter a date
range and this is what it will come from.

I have created a query that shows me the exact data that I want, but only
where there is a QTYSOLD for a SALESPERSON and STOCKCAT.

My actual problem is that I want to show all of the SALESPERSONs and
STOCKCATs available and if some don't have a value for the above then they
show a value of 0.00.

I've really been trying since you last helped me and I think the reason why
the above isn't working is because I need to perform a different kind of
JOIN so that I can get all of the SALESPERSONs and STOCKCATs from the
relevant tables.

The only problem with this is that my tables are as follows and when I do a
JOIN in MS Query it says it can't be done on more than 2 tables:


tbl_SALESPERSONS contains SALESPERSONID and SALESPERSONNAME (I need all of
the SALESPERSONNAME)

which is linked to the SALESPERSONID in

tbl_INVOICEHEADER contains SALESPERSONID, INVOICEID

which is linked to the INVOICEID in

tbl_INVOICELINES contains INVOICEID, STOCKID, QTYSOLD, DATESOLD (I need
QTYSOLD and DATESOLD)

which is linked to the STOCKID in

tbl_STOCK contains STOCKID, STOCKCATID

which is linked to the STOCKCATID in

tbl_STOCKCAT contains STOCKCATID, STOCKCATNAME (I need all of the
STOCKCATNAME)


How can I do this when I need the above to link of it all together??

Your help (as always) would be appreciated.

Rgds

Laphan




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
100% quandry Mojo Excel Discussion (Misc queries) 6 June 1st 09 01:56 PM
COUNTIF quandry JohnLute Excel Worksheet Functions 6 August 20th 07 06:29 PM
Multivariable Data Spreadsheet Quandry joebags Excel Discussion (Misc queries) 0 April 11th 06 05:44 PM
Macro Quandry Desiree Excel Discussion (Misc queries) 2 July 29th 05 01:32 PM
macro quandry.....?? Daesthai Excel Discussion (Misc queries) 2 June 29th 05 07:29 PM


All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"