Azure means hybrid now
On Monday 24 September 2018, Microsoft announced a slew of stuff at their annual Ignite conference that is going to...
2018-09-26
387 reads
On Monday 24 September 2018, Microsoft announced a slew of stuff at their annual Ignite conference that is going to...
2018-09-26
387 reads
The Azure cloud platform lost a data centre for a number of hours recently due to inclement weather. This affected...
2018-09-19
247 reads
Fellow Canadian Doran Douglas brought this issue to my attention recently, and I wanted to share it with you as...
2018-09-12
309 reads
Continuing the series on dates and times in SQL Server and Azure SQL Database, this week we look at the...
2018-09-05
281 reads
A few months ago I ran into a problem after updating Visual Studio for Mac, where it would not start....
2018-08-30
364 reads
Content warning: This is the second (and final) rebuttal essay about why someone is wrong on the Internet. It is...
2018-08-29
329 reads
Content warning: This is the first of two rebuttal essays, about why someone is wrong on the Internet. It is...
2018-09-10 (first published: 2018-08-22)
3,164 reads
Shall I compare thee to Management Studio? Thou art more scriptable and consistent. Those out-of-memory errors do tend to lose...
2018-08-15
337 reads
A shorter post this week, but an important one. Last week, Erik Darling commented on my post saying that we...
2018-08-08
482 reads
Recently Brent Ozar posted a link to the PostgreSQL “Don’t do this” page, which I am shamelessly reproducing below, re-tailored...
2018-08-01
525 reads
By Steve Jones
I’ve become an EV guy. I was talking with a friend who was selling...
In a previous post I talked about how we can use T-SQL Snapshot Backups...
By Steve Jones
A bit of a photo dump, but a few fun memories for me from...
Hello, We recently migrated a database from SQL Server 2014 to SQL Server 2022....
Comments posted to this topic are about the item Detecting Outliers in Power BI...
Comments posted to this topic are about the item Missing Returns
I have a few tables in my SQL 2025 database:
CREATE TABLE [dbo].[Customer] ( [CustomerID] [int] NOT NULL, [CustomerName] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [AddressKey] [int] NULL, [CustomerStatus] [int] NULL, [CustomerContact] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [ContactEmail] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [PreferredName] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Customer] ADD CONSTRAINT [CustomerPK] PRIMARY KEY CLUSTERED ([CustomerID]) ON [PRIMARY] GO CREATE TABLE [dbo].[Orders] ( [OrderID] [int] NOT NULL, [CustomerID] [int] NOT NULL, [ProductID] [int] NOT NULL, [OrderDate] [date] NOT NULL, [Quantity] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [PK__Orders__C3905BAFE0146D59] PRIMARY KEY CLUSTERED ([OrderID]) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [FK_Orders_Customers] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[Customers] ([CustomerID]) GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [FK_Orders_Products] FOREIGN KEY ([ProductID]) REFERENCES [dbo].[Products] ([ProductID]) GO CREATE TABLE dbo.CustomerReturn ( EntryID INT NOT NULL CONSTRAINT CustomerReturnPK PRIMARY KEY , CustomerID INT , ReturnDate DATETIME , OrderID INT NOT NULL ) GOThere are multiple rows in all these tables. I am trying to find how many customers have never returned anything, and I run this:
SELECT count(*)
FROM dbo.Customer
WHERE CustomerID NOT IN
(
SELECT CustomerID FROM dbo.CustomerReturn
);
I get zero rows, but I know there are customers who have not returned anything. What is wrong? See possible answers