473,427 Members | 1,596 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,427 software developers and data experts.

Null date

I have one table with id,name,submission date and followup date.
followup date may be null.
i have to select id from this table where followupdate is less than given date.
and if followup date is null then I have to select id from this table where submission date is less than given date.
Jun 22 '10 #1
5 1897
code green
1,726 Expert 1GB
A comparison to a NULL is meaningless.
You could use COALESCE
Expand|Select|Wrap|Line Numbers
  1. WHERE given date >= COALESCE(followupdate,submission)
Jun 22 '10 #2
debasisdas
8,127 Expert 4TB
then select it, what is the problem ?
Jun 22 '10 #3
Jerry Winston
145 Expert 100+
Can you share your query?
Jun 29 '10 #4
@b0010100
You can try to play around something like:

SELECT * FROM table1 where followup < @date and followup is not null
Union
SELECT * FROM table1 where is not null and submissionDate < @date
Jun 29 '10 #5
Jerry Winston
145 Expert 100+
Code Green said it best: "A comparison to a null is meaningless"

Try using isNULL(field,'ValueIfNull'):

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM table1 where NOT isNull(followup,'NULL') = 'NULL' 
  2. AND
  3. followup < @date
  4. Union
  5. SELECT * FROM table1 where NOT isNull(submissionDate,'ThisDateISNULL') = 'ThisDateISNULL'
  6. AND 
  7. submissionDate < @date 
Jun 29 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: evolve | last post by:
why doesn't c# seem to support some kind of 'null date' for instance: i have an application where the user is not obliged to enter a date until an event happens (e.g. a bug was fixed on xyz) ...
1
by: Vern | last post by:
I'm using the Microsoft Enterprise Data Access block to call the stored procedure. One of the values the stored procedure returns is the stop date. When the stop date is null, the program crashes....
6
by: Dean Slindee | last post by:
I am looking for the "right" way to handle inserting and presenting null date values. Public Const c_NullDate As Date = #12:00:00 AM# If I set the value of a date variable in an SQL Server insert...
1
by: GB | last post by:
Is there a function to set a null date in vb.net? Normally, I create a const NULLDATE = "1/1/1900", but that becomes a drag at times. Especially, handling a nulldate from SQL into a dataset. ...
10
by: Brad | last post by:
If I need to assign a NULL value to a date variable, how would I go about doing that? For right now I am using 01-01-2001, however I don't want to use a "real" date if the date should really be...
0
by: Ronald S. Cook | last post by:
When I pass a null date from my client to my service project, it comes across as #12:00:00 AM#. While I can easily code for this, it seems like a hack. Is this normal? I'm using WCF, by the...
1
by: klove1209 | last post by:
Good afternoon, I am currently working on this unbounded form that has numerous date fields. I wanted to know if it is possible to save data in a form, with a null date field. I am currently...
3
by: metsu962 | last post by:
Okay so I've been tearing my hair out for weeks over this issue. What I have is a Crystal Report that's showing a table pulled from an Access Database. The database is a HUGE pile of junk and it...
5
by: iwasinnihon | last post by:
I have written the following SQL to take data off of a form and insert it into a table. sql = "INSERT INTO Water Values('" & Me.AccountNumber & "','" & Me.Department & "','" & Me.Delivery &...
1
by: mwittekiend | last post by:
I am trying to convert a NULL date to a Y/N flag. It is giving me a conversion error. Here is the code. Any help is appreciated. Thanks 'CommitDateTimeFlag' = (case when CommitDateTime IS NULL...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.