Viewing 15 posts - 106 through 120 (of 4,076 total)
To select all rows from CustomerLeft change join precedence by parentheses:
SELECT *
FROM dbo.CustomerLeft AS cl
LEFT JOIN (dbo.CustomerContact AS cc
INNER JOIN dbo.EmailDomain AS...
July 31, 2023 at 1:31 pm
Here is an alternative that a) does not use an OR
and b) does not use a subquery.
WITH TempOrdered AS
(
SELECT t.ID
...
July 27, 2023 at 1:17 pm
Here is an alternate solution that doesn't require a CTE. NOTE: I've used COUNT()
instead of SUM()
, because COUNT()
never returns a NULL value, whereas SUM()
might--and does for the...
July 18, 2023 at 1:23 pm
I've had to ad an identity column (ID) so the table can be ordered by something:
DECLARE @T table (ID int IDENTITY(1, 1), A int )
insert...
July 18, 2023 at 1:14 pm
@michael-2, My understanding is that you cannot switch partitions if there are indexes that are not aligned with the partition.
@Alexp, Have you tried DISABLE
/REBUILD
instead of DROP
/CREATE
?
Drew
June 29, 2023 at 6:16 pm
Please provide sample data in the form of DDL to create (temp) tables and DML to insert data into those tables.
You do realize that UNION
automatically removes duplicates. Since your...
June 29, 2023 at 1:16 pm
It's because you're using the wrong GROUP BY expression. You're grouping on DATE, not by MONTH. You need to use an expression that gives you the same value for every...
June 27, 2023 at 8:57 pm
WHY are you using dynamic SQL for this? WHY?
You never tell it to alter the view. How is it supposed to know to alter the view unless you tell it...
June 27, 2023 at 8:41 pm
FIRST, this will delete ALL records rather than "leaving a single item".
I would use ROW_NUMBER()
rather than COUNT()
, because ROW_NUMBER()
guarantees a unique way to identify each row, whereas COUNT()
does...
June 27, 2023 at 8:35 pm
There are a couple of issues with your script.
June 5, 2023 at 3:28 pm
I think the following will handle resetting the value to zero when the date changes and the direction changes. I've added a calculation for the arrival date, since I'm using...
June 5, 2023 at 3:16 pm
This is another approach that will also work across days.
WITH ua AS
(
Select
[action] --This is where login and...
May 25, 2023 at 8:14 pm
declare @torig table (custid int, employeecount int, datadate date)
insert into @torig values
(1, 10, '1-Jan-2023'), -- 21
(1, 11, '1-Jan-2023'),
(2, 11, '1-Jan-2023'),
(1, 15, '2-Jan-2023'), -- 28
(1, 11, '2-Jan-2023'),
(1,...
May 23, 2023 at 5:33 pm
If you want tested code, please provide a script to create a sample data and expected results in the form of a script to create temp tables with insert scripts. ...
May 23, 2023 at 1:11 pm
This is not an aswer to your question, but...
Your criteria AND (ITPRDC != 'AX' OR ITPRDC != ' ') looks wrong to me. And it's not your use of...
May 18, 2023 at 1:58 pm
Viewing 15 posts - 106 through 120 (of 4,076 total)