Viewing 15 posts - 706 through 720 (of 3,500 total)
The short answer to your question is to use the LAG function to get the value from the previous record. Something like this...
LAG([LoginTime],1) OVER (PARTITION BY EmpID ORDER BY [LoginTime])
Oh...
June 17, 2020 at 3:00 pm
Maybe use SSIS and a For Each file loop, and dump them all into a single table?
Or use Excel... put all the files in a single folder, use a folder...
June 16, 2020 at 4:38 pm
1 lakh = 100,000
June 16, 2020 at 2:51 pm
This place is really quiet compared to the normal before COVID. Makes me wonder if all the SQL folks got laid off.
June 16, 2020 at 12:29 am
If EffectiveDate indexed? What does the new execution plan look like for the updated query?
June 14, 2020 at 6:08 am
Read that maybe 20 times before I understood. LOL Let me see if I have this right... If this were a "normal" table of component parts...
CREATE TABLE Component(ComponentID INT IDENTITY...
June 10, 2020 at 12:17 am
If you have a Calendar table that's similar to one you would use for a Date dimension in DAX/SSAS Tabular, you could just specify the start and end dates of...
June 8, 2020 at 8:59 pm
progress! I created a Table-valued function to do the BOM stuff, then used CROSS APPLY to join it to OrderDetails, and it worked. (It's an approximation of a Work Order...
June 4, 2020 at 3:16 pm
Same as mine, except I put the column names at the beginning.
Glad you sorted it out. I didn't want to just give you the answer, because then you wouldn't learn...
June 3, 2020 at 2:47 pm
Oops, yes, I did miss it. This is what I used. (Funny I would get the answer right and then miss copying it... the easy part!)
SELECT AllergyName
,LowStart...
June 3, 2020 at 2:54 am
This is how I did it...
SELECT AllergyName
,LowStart = MAX(CASE WHEN ScaleValue = 'Low' THEN ScaleStart END)
,LowEnd = MAX(CASE WHEN ScaleValue = 'Low' THEN ScaleEnd END)
,ModerateStart = MAX(CASE...
June 3, 2020 at 12:31 am
I could do it like this, I suppose...
use AdventureWorks2017;
go
-- what parts are in stock
SELECT currInv.ProductId
, currInv.TotalQOH
, sod.OrderQty
, rt_Sold = SUM(sod.OrderQty) OVER (PARTITION BY currInv.ProductID
ORDER BY soh.OrderDate
ROWS...
June 2, 2020 at 10:27 pm
I'll give you a hint... MAX( CASE WHEN...)
It's a LOT of that.
Jeff Moden posted an article on Crosstabs... that might help too. (Don't want to give the game away... I...
June 2, 2020 at 6:05 pm
Viewing 15 posts - 706 through 720 (of 3,500 total)