Learn how to sort on multiple date fields when null values exist by using a calculated field. By using the IIf function with Is Null, you can easily sort to see the most recent (or oldest) records.
We’ve included information on avoiding the IsNull function to maintain SQL Server compatibility. Additional information and examples are provided to show why using the NZ function (NullToZero) is not equivalent and returns the wrong results.
The purpose of the SQL UNION query is to combine the results of two or more queries into a single result set. The list contains all the rows belonging to all the queries in the union. This applies to queries in SQL Server or Microsoft Access. A common question is whether to use the UNION or UNION ALL syntax.
The main difference between UNION ALL and UNION is that, UNION only selects distinct values and sorts the results, while UNION ALL selects all values (including duplicates) without sorting. Read our revised paper on UNION versus UNION ALL SQL Syntax to learn more about the differences, see some examples, and understand why you would use one versus the other.
Microsoft Access Queries are among the most powerful features of MS Access. We have created a new resource center to make it easy to review all our papers related to Microsoft Access Queries. These original works offer tips and techniques aren't found anywhere else. They will help you maximize your use of Microsoft Access queries to better analyze and understand your data.
In our continuing coverage of query tips and techniques, we've create a paper focused on the DELETE query in Microsoft Access. It covers the basics of DELETE query SQL Syntax. It's a very powerful feature and a fundamental part of relational databases since you can remove multiple records at one time, and can specify which records to delete by linking to data in another table.
The paper also covers these more advanced topics:
Query fails: "Could not delete from the specified tables"
Use DISTINCTROW with Delete Queries for Non-Key Field Joins
Understanding and using Delete Queries improves the performance of your applications and makes them easier to maintain versus doing the same changes manually or in code.
Here's another resource in our ongoing coverage of query techniques:
Learn how to create queries to find all the records in one table that don't have corresponding records in another table. If you're not familiar with the difference between INNER JOIN, OUTER JOIN, LEFT JOIN and RIGHT JOIN, check out this new paper on these important query feature. It'll save you tons of time trying to code this yourself and will surely give you new ideas on how to better retrieve and analyze your data. The techniques apply to both Microsoft Access and SQL Server queries.
Here's an additional paper related to our ongoing coverage of queries. This time we're covering DELETE query syntax in Microsoft Access. In addition to the basics of deleting data and the SQL for DELETE queries, we also cover an interesting situation when DELETE queries fail during multi-table links on non-keyed fields.
If your query fails to delete any records with this message: "Could not delete from the specified tables", learn why and how to fix it with the DISTINCTROW syntax or setting the Unique Records property to Yes.