I'm sure this is easy but I've been banging my head on it for a while and can't come up with the proper solution,
I have two tables maintaining transaction records for items,
whscosthdr [whh_cdate,whh_username,whh_trans_no,whh_tsource,whh_from_loc,whh_to_loc,whh_pct_incr]
whscostdtl...
Hi Rudy,
Yes, it's quite the query but performs extremely fast so my indexes must be working well ! :) The sales table has millions and millions of records and the query is generated dynamically with lots of parameters...
I'm not really sure I can get rid of the 2nd temporary table. I cannot...
Rudy,
I've implemented your solution and it is giving me exactly the results I am looking for.
The sales data that I am using is the result of a fairly long query . Because I need to use the resultset of this query twice in your solution (once for the grp table, once for the loc table) I...
It makes so much sense now that I'm looking at your sql code...I don't know why that didn't come to me. Thank you so much for your help...now I'm off to implement :)
Hi r937, you've helped me a great deal in the past, good to see you're still around helping out!
My columns are
his_key (group/department)
key_desc
his_loctn (location)
ty_retail
ty_cost
ty_units
ly_retail
ly_cost
ly_units
My ORDER BY clause is
ORDER BY his_key, his_loctn
Some SQL would...
I have a query that totals up sales at retail and cost by Group/Location. Up to this point I have been just ordering my results by group name (alphabetically) and by location. I need to now sort by results by the Group with the most sales.
So if my results before were like the following,
CHILD...
Thanks for you feedback. At least I know I'm on the right track with the join structure.
I believe the reason I'm getting more records than I should is due to what you mentioned, the one-to-many relationships. Table A has a one-to-many relationship with tables B and C. I'll do some more...
I need to make a join between 3 tables, where the 3rd table is dependent on the join of the first two. Here's an example to elaborate,
Table A
A.col1
A.col2
...
A.colN
Table B
B.col1
B.col2
B.col3
...
B.colN
Table C
C.col1
C.col2
C.col3
...
C.colN
I need col1 from table A, col2 from table B...
Here's what I've come up with so far, and I just noticed it's very similar to Riverguy's response,
SELECT MenuItem.*
, sales.*
FROM MenuItem
JOIN (
SELECT DISTINCT custitem.PLU
, custitem.LocationNo
, MAX(Custinv.InvoiceDate) AS LastSold
FROM Custinv JOIN custitem
ON...
I need to write a query selects all items from an inventory table 'MenuItem' that have sold since a user specified date. The sales table 'Custinv' has a record for every item sold by date and location (quite a large amount of records).
I'm not really sure how to proceed, should I be joining...
Just a quick update on my laptop. The technician replaced the motherboard this morning and that corrected the problem. Looks like it was hardware after all.
Hi Phil, thanks for your response.
My laptop has a FN+F5 to enable dual display. This just mimics the Win+P button function. I have also tried enabling it from nvidia control panel as well as through the windows control panel.
I have also tried completely removing and reinstall the nvidia...
Whenever I try to enable a secondary display on my laptop it detects the monitor but then all it does is flash the desktop and then go black, like it's stuck in this auto-detect loop or something. I have tried multiple monitors and get the same thing. What's even funnier is that it worked the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.