Viewing 15 posts - 676 through 690 (of 2,452 total)
so what results would you expect from here.....(earlier post was not the sample data I intended posting...sorry)
CREATE TABLE #BuyData(
[Party_Code] [varchar](10) NULL,
[Item] [varchar](20) NULL,
[TradeDate] [smalldatetime] NULL,
[PurchaseQty] [int] NULL,
[Tsrno] [bigint] IDENTITY(1,1) NOT...
May 18, 2016 at 11:19 am
I am confused and I think your sample data may be over simplified.
kudos for the set up data though...it helps a lot.
what would you expect in this sample data?
CREATE TABLE...
May 18, 2016 at 8:48 am
Sergiy (5/9/2016)
R.P.Rozema (5/9/2016)
Even though the solution presented here has serious limitations (and I think serious flaws too),
I wonder who can see more of them - me or you? 🙂
I...
May 16, 2016 at 3:36 pm
some sample data and expected results would help me thinks
May 16, 2016 at 1:54 pm
drew.allen (5/16/2016)
J Livingston SQL (5/15/2016)
WITH cteprices as (
SELECT itmId,
price,
ROW_NUMBER() OVER(PARTITION...
May 16, 2016 at 1:15 pm
drew.allen (5/16/2016)
J Livingston SQL (5/15/2016)
WITH cteprices as (
SELECT itmId,
price,
ROW_NUMBER() OVER(PARTITION...
May 16, 2016 at 1:14 pm
just to remind you again....without any columns to order your prices by, you are leaving yourself open to report the wrong results.
making an assumption today. that prices will for now,...
May 16, 2016 at 12:56 pm
maybe...
DECLARE @prices TABLE (
itmId int,
price money
)
INSERT INTO @prices VALUES (1, 1000)
INSERT INTO @prices VALUES (1, 1500)
INSERT INTO @prices VALUES (1, 1800)
INSERT INTO @prices VALUES (2, 2000)
INSERT INTO @prices VALUES (2,...
May 16, 2016 at 12:47 pm
maybe....
SELECT FromDate,
ToDate,
MAX(CASE
...
May 16, 2016 at 11:04 am
randyetheridge (5/16/2016)
May 16, 2016 at 10:37 am
maybe....use following and then do a crosstab
WITH cteprices as (
SELECT itmId,
price,
ROW_NUMBER() OVER(PARTITION BY itmId ORDER BY...
May 15, 2016 at 4:23 am
well you could use ROW_NUMBER to do that....but what happens when a price drops?
what you suggest will only work if proces are continualy increasing.
I find it very hard to believe...
May 15, 2016 at 3:30 am
do you have anything in your prices table that indicates order....eg datetime / Id ?
I think you need that to determine which price is Price1/Price2/ etc
May 15, 2016 at 3:15 am
does seem a little like homework.....hmmm
anyways and only because I have been playing around with converting screen grabs into usuable create table statements.....
----http://www.sqlservercentral.com/Forums/Topic1784995-391-1.aspx
CREATE TABLE #Finance(
PID ...
May 14, 2016 at 10:41 am
zahid.techk (5/14/2016)
Select DATENAME(MM,TransHdr.TransDate)As Month_Name,--(It Shows Only Months Name)
Count(TransHdr.TransNum) As Total_Test,
LAG(TransHdr.TransNum,1,0)As Prvs_transaction-- Over (Order by Month(TransHdr.TransDate)) As Prvs_transaction)
...
May 14, 2016 at 4:29 am
Viewing 15 posts - 676 through 690 (of 2,452 total)