Viewing 15 posts - 361 through 375 (of 1,424 total)
Why store information which is derivable by query? It sometimes creates race conditions keeping updated. If you're looking for performance you could try splitting the clustered index away from the...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 29, 2022 at 11:30 pm
Here's a query with some date calculations. The value calculated in CROSS APPLY is the difference in days between the customer's DateofJoin and the order's DateVal. Based on this difference...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 28, 2022 at 9:12 pm
The data contains a duplicate row. How to handle duplicates? Also, VID is nullable so are NULLs to be ignored or treated collectively as a VID?
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 25, 2022 at 12:33 pm
Once they realized the mistake, they attempted to soften the blow by creating DATEDIFF_BIG. A valiant attempt that works nicely except for the rather obvious and unfortunate fact that...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 23, 2022 at 2:49 pm
You could divide the rows using two queries: one above and one below UNION ALL. Above SELECT ID's with [type]='Alias' and below SELECT ID's without any 'Alias'. You could assign...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 16, 2022 at 12:48 am
One Youtube channel is the CMU Database Group from Carnegie Mellon University. My brother went to CMU and one of his sons goes there now. Their earlier series are...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 15, 2022 at 2:00 pm
To make the comparison between rows you could use the LAG function. Then use integer division programYearValue/100 to extract the start year and take the modulo 100 of the lagged...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 13, 2022 at 9:27 pm
Why is there no primary key on the extractreports.dbo.partsrecomendationActive table? You have a clustered index and yet UNIQUE is not specified. This seems to cause a merge join and it's...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 10, 2022 at 4:00 pm
Regarding the time it takes different member have different approaches. For me it's usually asap without too much nth degree refactoring. Whatever gets people unstuck. I'm a developer too so...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 9, 2022 at 1:24 pm
Happy it helps! Thanks for the feedback 😊
It was a medium challenge. Your follow up post cleared up the lot size issue. Maybe an hour or so added together. Estimating...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 8, 2022 at 1:25 pm
Thanks for the further explanation. This query takes a number of passes at the data due to multiple uses of windowing functions. It assumes 'Item' to be a PARTITION BY...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 7, 2022 at 7:52 pm
Is this the equation? The change in monthly quantity is labelled as delta_q.
quantity_on_hand + delta_q + production_proposal - lot_size - minimum_stock = 0
In month 1:
quantity_on_hand=4,000, delta_q=0, lot_size=810, and minimum_stock=4050
4,000+0+production_proposal-810-4050=0
production_proposal=860
In month...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
September 7, 2022 at 1:24 pm
Before calculating the ytd amounts you could first summarize to the month. Then CROSS APPLY to get ytd amounts
drop table if exists #myfacttable;
go
create table #myfacttable(
businessdate...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
August 25, 2022 at 11:43 pm
where OrderDate>=dateadd(day, 1, eomonth(getdate(), -1))
and OrderDate<datefromparts(year(getdate()), month(getdate()), 16)
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
August 24, 2022 at 1:53 pm
It seems there are 3 compound conditions: 1) where (drive=c and percentage free<10), or 2) where (drive!=c and percentage free<20), and 3) where not (server=vc5 and drive in (...)). Maybe...
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
August 18, 2022 at 11:49 am
Viewing 15 posts - 361 through 375 (of 1,424 total)