Home All Groups Group Topic Archive Search About

selecting on a null col.

Author
29 Jun 2006 11:42 PM
Aussie Rules
Hi,

I have a date type column and want to be able to select from the table with
a where clause on the date column.

I want to be able to select where the date is say less than now (getdate),
and include records where the date is null.

I added the 'or' clause below, however it seems to break all my inner joins.
(there are a bunch of 'inner joins' and 'and' in the sql statement). What is
the correct syntax to get back records where the date is less than now, or
where its null.

and tbl_property.listingExpires > getdate() or tbl_property.listingExpires
is null

Author
30 Jun 2006 12:51 AM
Arnie Rowland
It would be so-o-o-o much easier to help you with this if you would provide
us with the entire query.

--
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."

*Yet Another Certification Exam


Show quote
"Aussie Rules" <AussieRules@nospam.nospam> wrote in message
news:eX3sDY9mGHA.1272@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I have a date type column and want to be able to select from the table
> with a where clause on the date column.
>
> I want to be able to select where the date is say less than now (getdate),
> and include records where the date is null.
>
> I added the 'or' clause below, however it seems to break all my inner
> joins. (there are a bunch of 'inner joins' and 'and' in the sql
> statement). What is the correct syntax to get back records where the date
> is less than now, or where its null.
>
> and tbl_property.listingExpires > getdate() or tbl_property.listingExpires
> is null
>
>
>
>
>
>
Author
30 Jun 2006 1:22 AM
Roy Harvey
On Fri, 30 Jun 2006 00:42:54 +0100, "Aussie Rules"
<AussieRules@nospam.nospam> wrote:

>and tbl_property.listingExpires > getdate() or tbl_property.listingExpires
>is null

Just guessing, of course.

AND (tbl_property.listingExpires > getdate()
  OR  tbl_property.listingExpires IS NULL)

Roy Harvey
Beacon Falls, CT
Author
30 Jun 2006 1:53 AM
Stu
Roy Harvey wrote:
> On Fri, 30 Jun 2006 00:42:54 +0100, "Aussie Rules"
> <AussieRules@nospam.nospam> wrote:
>
> >and tbl_property.listingExpires > getdate() or tbl_property.listingExpires
> >is null
>
> Just guessing, of course.
>
> AND (tbl_property.listingExpires > getdate()
>   OR  tbl_property.listingExpires IS NULL)
>
> Roy Harvey
> Beacon Falls, CT

Another stab in the dark:

AND COALESCE(tbl_property.listingExpires, GETDATE()) >= GETDATE()

But as Arnie said, a query would be helpful.  I could have just as
easily said

AND BrownCow = Plutonium

Stu
Author
30 Jun 2006 2:13 AM
Mike C#
"Stu" <stuart.ainswo***@gmail.com> wrote in message
news:1151632425.537125.76410@m73g2000cwd.googlegroups.com...
>
> AND BrownCow = Plutonium

Watch out for those NSA watchwords!  I hear "BrownCow" is near the top of
the terrorist watchlists!
Author
30 Jun 2006 2:37 AM
Arnie Rowland
Brown Cow is my favorite brand of yogurt. Some foods are irradiated to
'kill' bacteria. But then again, we know that yogurt comes from the middle
east -so talking about yogurt, brown cows, AND tossing in the Plutonium word
will most certainly raise alarms about middle eastern vegetarians run amok!

Expect the unexpected knock on the door, and watch out for those low flying
black helicopters.

--
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."

*Yet Another Certification Exam


Show quote
"Mike C#" <x**@yyy.com> wrote in message news:1O%og.94$V14.74@fe09.lga...
>
> "Stu" <stuart.ainswo***@gmail.com> wrote in message
> news:1151632425.537125.76410@m73g2000cwd.googlegroups.com...
>>
>> AND BrownCow = Plutonium
>
> Watch out for those NSA watchwords!  I hear "BrownCow" is near the top of
> the terrorist watchlists!
>
Author
30 Jun 2006 5:58 AM
Charles Wang[MSFT]
Hi,
Thanks for your post!
My understanding of your issue is:
When you appended the condition to the WHERE clause, your query logic was
broken.
If I have misunderstood, please let me know.

I recommend you take Roy's suggestion adding brackets out of the condition
at first.
If you have any other concerns, please feel free to let me know.

Enjoy your day!

+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.

This and other support options are available here:

BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others:
https://partner.microsoft.com/US/technicalsupport/supportoverview/

If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
=====================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Author
30 Jun 2006 6:51 AM
Aussie Rules
HI,

The adding of the () around the statement solved the problem..... should
have seen that one!

Thanks all


Show quote
"Charles Wang[MSFT]" <chang***@online.microsoft.com> wrote in message
news:rt7o%23oAnGHA.4632@TK2MSFTNGXA01.phx.gbl...
> Hi,
> Thanks for your post!
> My understanding of your issue is:
> When you appended the condition to the WHERE clause, your query logic was
> broken.
> If I have misunderstood, please let me know.
>
> I recommend you take Roy's suggestion adding brackets out of the condition
> at first.
> If you have any other concerns, please feel free to let me know.
>
> Enjoy your day!
>
> +++++++++++++++++++++++++++
> Charles Wang
> Microsoft Online Partner Support
> +++++++++++++++++++++++++++
>
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
>
> =====================================================
> Business-Critical Phone Support (BCPS) provides you with technical phone
> support at no charge during critical LAN outages or "business down"
> situations. This benefit is available 24 hours a day, 7 days a week to all
> Microsoft technology partners in the United States and Canada.
>
> This and other support options are available here:
>
> BCPS:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
> Others:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/
>
> If you are outside the United States, please visit our International
> Support page:
> http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
> =====================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
Author
30 Jun 2006 7:49 AM
Charles Wang[MSFT]
Hi ,

Appreciate your update and response. I am glad to hear that the problem has
been fixed. If you have any other questions or concerns, please do not
hesitate to contact us. It is always our pleasure to be of assistance.

Have a nice day!

+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.

This and other support options are available here:

BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others:
https://partner.microsoft.com/US/technicalsupport/supportoverview/

If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
=====================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

AddThis Social Bookmark Button