Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SQL Syntax Question

New Here ,
Sep 04, 2008 Sep 04, 2008
I am using CF 7.0 and SQL Server 2003. I'm writing a slightly complex (to me, anyway) SQL query, but I'm not getting the results I want... so I think there's something wrong with my query.

What I want to do is return a list of people from an organization where the date field for the date someone took a course is either earlier than today or NULL.

This is my code so far:

<cfset todayDate = Now()>

Select * FROM qry_memberCourses
WHERE course_id = 30
AND unit_cd = 'CF'
AND (due_dt < #todayDate# OR due_dt = NULL)

the query works, but only returns those records where someone's due date has passed... not those who have a NULL value in the due_dt field. Suggestions?
TOPICS
Database access
325
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Sep 04, 2008 Sep 04, 2008
LATEST
Try IS NULL

Select * FROM qry_memberCourses
WHERE course_id = 30
AND unit_cd = 'CF'
AND (due_dt < #todayDate# OR due_dt IS NULL)

Phil
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources