I have two large tables:
products
--------
id (char) (primary key)
somefield1 (char)
somefield2 (char)
and
expired_products
------
id (char) (primary key)
I want to only have those ids which are in products but are not expired (id not in expired_products). In MS Access I would do something like this
SELECT products.*
FROM products LEFT JOIN expired_products ON products.id = expired_products.id
WHERE expired_products.id Is Null;
Ultimately, I want to write the result of the query into a new table.
Is there any better (faster query) solution in SQL Server Compact (sdf file)?
Btw. I am using C# and using the SqlCeConnection to access the database.
This is command to execute in C#, it’s “insert into … select …” statement:
Added after comment:
INSERT (SQL Server Compact) on MSDN
From MSDN:
derived_table
Any valid SELECT statement that returns rows of data to be inserted into the table.