Access substitute for EXCEPT clause
In order to get rid of the EXCEPT
you could combine the conditions and negate the second one:
SELECT DISTINCT
P.Name,
T.Training
FROM Prof AS P,
Training_done AS TC,
Trainings AS T
WHERE ((P.Name Like '*' & NameProf & '*') AND
(P.Primary_Area = T.Cod_Area))
AND NOT ((P.Name Like '*' & NameProf & '*') AND
(P.Cod_Prof = TC.Cod_Prof));
UNION does not work in access
Access SQL doesn't have EXCEPT
.
You'll have to use WHERE NOT EXISTS
or an outer join.
Access substitute for clause except may help to find a workaround.
SQL subqueries alternative to INTERSECT
Do not know how the performance is .. try it ..
SELECT P.Name
FROM P
INNER JOIN PC AS a ON P.Id=a.Id and a.Cod='A' and a.Val>100
INNER JOIN PC AS b ON P.Id=b.Id and a.Cod='B' and a.Val>80
How can I implement SQL INTERSECT and MINUS operations in MS Access
INTERSECT is an inner join. MINUS is an outer join, where you choose only the records that don't exist in the other table.
INTERSECT
select distinct
a.*
from
a
inner join b on a.id = b.id
MINUS
select distinct
a.*
from
a
left outer join b on a.id = b.id
where
b.id is null
If you edit your original question and post some sample data then an example can be given.
EDIT: Forgot to add in the distinct to the queries.
coalesce alternative in Access SQL
Access supports the Nz
function and allows you to use it in a query. Note though that Nz
is the same as the T-SQL ISNULL
function. It can not take an arbitrary number of parameters like COALESCE
can.
Related Topics
Why Are Batch Inserts/Updates Faster? How Do Batch Updates Work
Sql: Using Null Values VS. Default Values
SQL Query for Getting Data for Last 3 Months
How to Get Last Day of Last Week in SQL
Rolling 90 Days Active Users in Bigquery, Improving Preformance (Dau/Mau/Wau)
How to Combine Aggregate Functions in MySQL
Cannot Bulk Load. the File "C:\Data.Txt" Does Not Exist
Return Number from Oracle Select Statement After Parsing Date
MySQL 'Create Schema' and 'Create Database' - Is There Any Difference
Use Variable with Top in Select Statement in SQL Server Without Making It Dynamic
Warning: Null Value Is Eliminated by an Aggregate or Other Set Operation in Aqua Data Studio
SQL Sort by Version "Number", a String of Varying Length
SQL Filter Criteria in Join Criteria or Where Clause Which Is More Efficient