TechnologyAdvice does not include all companies or all types of products available in the marketplace. Remember Me? Advertiser Disclosure. Advanced Search. Forum Miscellaneous Ask an Expert select Max and null value. Results 1 to 9 of 9. Thread: select Max and null value. Join Date Jul Posts One contact can have many orders. I built a query with the contact and orders tables, grouped by the linked customer number in orders and made a max order date field.
When I changed my form to display from this query, I lost all my opportunity accounts—those with no max order date. I also lost the ability to add new records. How can I make the query show ALL records even those with no orders and therefore no max order date?
This site uses Akismet to reduce spam. Learn how your comment data is processed. Enter your email address to subscribe to this blog and receive notifications of new posts by email. Email Address. Skip to content SQL Server 4. Like this post? Otherwise the case will default to returning null which is also the answer. This is a very popular way to do this exact check. Assuming you have only one record with null in EndDate column for a given RecordID, something like this should give you desired output :.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question. Asked 7 years, 11 months ago. Active 2 years, 2 months ago. Viewed k times. I have a table where I am storing timespan data. Improve this question. Ant Swift Ant Swift Take a look at sqlfiddle. If only one record exists for a grouping, the NULL will be preserved, otherwise it will be overridden by any date.
It is an example result. I've updated the question so the results are valid for the sample data. Show 2 more comments. Active Oldest Votes. Improve this answer.
0コメント