Viewing 15 posts - 1,501 through 1,515 (of 2,452 total)
Louis Hillebrand (4/18/2014)
1861 possible solutions...PenDVDPenDriveMouseTV
115414
...
67 4261
No cursors, no loops..
But I took 6 minutes to run the query..
care to share the code Louis?
April 18, 2014 at 9:30 am
Brandie Tarvin (4/18/2014)
J Livingston SQL (4/18/2014)
try this article........AWESOME! Thanks for that link. Gail, as always, does wonderful work.
seems my googlefoo is working today 😀
this a problem that I was aware...
April 18, 2014 at 8:51 am
vignesh.ms (4/18/2014)
Brandie Tarvin (4/18/2014)
This sounds like a contest or homework problem to me.Should be mixture of all products..
I'm eagerly waiting for the query....
Pls try it out..
ok...here is an answer
;
WITH acte
AS...
April 18, 2014 at 8:24 am
Sean Lange (4/18/2014)
J Livingston SQL (4/18/2014)
quick Google....heres an article that may helphttp://davidduffett.net/post/5334646215/get-a-comma-separated-list-of-values-in-sql-with-for
JLS, I can't get that link to load. It just spins and spins. From the url is it using...
April 18, 2014 at 8:16 am
what do you want the result to be
100 pens or 80 mice ....you could have either for exactly $1000
or a mixture of other products as well......????
as others have already...
April 18, 2014 at 4:45 am
quick Google....heres an article that may help
http://davidduffett.net/post/5334646215/get-a-comma-separated-list-of-values-in-sql-with-for
April 18, 2014 at 4:20 am
does this get anywhere close...??
;
WITH cte
AS (
SELECT SalesOrderNumber,
ItemNumber,
QuantityOrdered,
MIN(VersionNumber) AS VerMin,
MAX(VersionNumber) AS VerMax
FROM Orders
GROUP BY SalesOrderNumber,
ItemNumber,
QuantityOrdered
)
SELECT cte.SalesOrderNumber,
cte.ItemNumber,
OMin.OrderDate,
OMin.RequestedDeliveryDate,
OMin.PromisedDeliveryDate,
OMin.QuantityOrdered,
OMax.PostingDate,
OMax.QuantityShipped
FROM Orders AS OMin
INNER JOIN cte ON OMin.SalesOrderNumber = cte.SalesOrderNumber
AND OMin.VersionNumber = cte.VerMin
AND OMin.ItemNumber =...
April 18, 2014 at 4:01 am
I am concerned that your sample data may be oversimplified...have you considered and provided test data for ALL possibilities.....I am think along the lines of:
>item being deleted from order
>order lines...
April 17, 2014 at 11:51 am
is the "quantity changed" column actually recorded in the Orders table?
it doesn't appear in your test setup
April 17, 2014 at 11:41 am
sidebar...js this a MS NAV database?
April 16, 2014 at 3:10 pm
itortu (4/16/2014)
That is what the output after processing the orders, respectively s19856 and s20026 should look like.
The column QuantityChanged should show...
April 16, 2014 at 3:08 pm
Sean
the following works,,,just left out the "QuantityChange" column (don't think its relevant to the question)
CREATE TABLE Orders
(
SalesOrderNumberNVARCHAR(20)
,VersionNumberINT
,ItemNumberNVARCHAR(20)
,OrderDateDATETIME
,RequestedDeliveryDateDATETIME
,PromisedDeliveryDateDATETIME
,QuantityOrderedDECIMAL(38,18)
,QuantityChangeDECIMAL(38,18)
,PostingDateDATETIME
,QuantityShippedDECIMAL(38,18)
,LocationCodeNVARCHAR(10)
)
INSERT INTO Orders (SalesOrderNumber, VersionNumber, ItemNumber, OrderDate, RequestedDeliveryDate,PromisedDeliveryDate, QuantityOrdered, PostingDate,QuantityShipped, LocationCode)
VALUES ('S19856',1,'10568','2014-02-13 00:00:00.000','2014-03-14...
April 16, 2014 at 2:26 pm
miles_lesperance (4/16/2014)
In your WHERE clause, you could try:WHERE DATEPART(dw, getdate()) in (2, 3, 4, 5, 6)
That should give you only weekdays.
quick note...make sure you understand what is the first day...
April 16, 2014 at 1:56 pm
your test data.....
USE [tempdb]
SET NOCOUNT ON
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SampleTable]') AND type in (N'U'))
DROP TABLE [dbo].[SampleTable]
GO
CREATE TABLE [dbo].[SampleTable](
[ColA] [int] NULL,
[ColB] [int] NULL,
[ColC] [varchar](50) NULL
)...
April 16, 2014 at 7:52 am
Viewing 15 posts - 1,501 through 1,515 (of 2,452 total)