Viewing 15 posts - 676 through 690 (of 1,403 total)
My apologies there was a mistake in the code. You're correct there shouldn't be duplicates as you described. In the 'xply_cte' CTE the 4th column contained an incorrect table alias. ...
April 15, 2021 at 12:53 pm
It's not a good approach imo. It's not necessary or polite to call anyone out. For my part I'm not familiar with the terms and I'm generally uninterested in gambling. ...
April 14, 2021 at 3:19 pm
You could maybe replace the whole WHILE LOOP'ing function with Eirikur's LEAD splitter. If this is SQL Server 2016+ you could use the built-in STRING_SPLIT itvf (since the order...
April 13, 2021 at 8:23 pm
The query could be simplified, no? Maybe something like this
select top(1) p.AkcesAutoID
from dbo.podrobnosti p
join ro.fntStringsToTable('J') ltrs on ltrs.EvidenceLetter = p.EvidenceLetter
...
April 13, 2021 at 7:44 pm
Here's another approach which uses a tally function to row multiply the 'Amount' column value(s) for both credits and debits. A similar approach to FIFO calculation recently won some...
April 5, 2021 at 8:02 pm
[Edit] This is pretty much the same as Phil's code in the other thread with same name.
with improper_cte(FirstName, LastName, DOB, ID) as (
select...
March 30, 2021 at 8:23 pm
Instead of writing a query to do this crosstab would it be possible to go back to whatever code landed you at those 2 rows with different ID's in the...
March 30, 2021 at 7:51 pm
Here's something close but not matching because maybe there's an issue with the example results? Could you explain for LID='L005' and EID='E002' how ALLO='21.00' and DAYSS='6.00' and then the RL...
March 30, 2021 at 1:57 pm
A framework-ish way could be to use the awkward DATETIMEFROMPARTS and its 7 required parameters.
declare
@today [varchar](12) = '44:10:27.766',...
March 28, 2021 at 10:47 pm
select c1.*
from #categories1 c1
where not exists(select 1
from #categories2 c2
...
March 28, 2021 at 8:10 pm
These 2 queries produce the output you're looking for. It should be said this is not a properly normalized data model. There seemingly are "non-modelled" relationship(s) in the data which...
March 28, 2021 at 3:09 pm
Nicely done The Dixie Flatline 🙂
March 25, 2021 at 7:54 pm
What about checking @@rowcount? This way 0 would only show up if there are no rows
SELECTCount(InvNo) AS RecordCount, BatchID
FROMBatchOrders
GROUP BY BatchID;
if @@ROWCOUNT=0
SELECT 0,...
March 25, 2021 at 7:04 pm
COUNT doesn't return 0 because you've also requested BatchID in the SELECT list. The FROM clause is evaluated first and there are no rows. On its own COUNT will always...
March 25, 2021 at 5:10 pm
Ok, Category appears to not be a reserved word and appears in white. Period and Value are both blue. So it's brackets, no brackets, and brackets instead of brackets, brackets,...
March 22, 2021 at 2:53 pm
Viewing 15 posts - 676 through 690 (of 1,403 total)