Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: (OT) Complex SQL Statement

by pjotrik (Friar)
on Jul 23, 2008 at 19:48 UTC ( [id://699678]=note: print w/replies, xml ) Need Help??


in reply to (OT) Complex SQL Statement

Really not the right place here, but OK. It would help to specify your db engine as well. It should go roughly like this:
select * from tbl where coalesce(actual_start, projected_start, some_deep_past) <= curre +nt_date and coalesce(actual_finish, projected_finish, some_far_future) >= curr +ent_date

Replies are listed 'Best First'.
Re^2: (OT) Complex SQL Statement
by massa (Hermit) on Jul 23, 2008 at 20:35 UTC
    even clearer (IMHO) and shorter:
    select * from tbl where current_date between coalesce(actual_start, projected_start, some_deep_past) and coalesce(actual_finish, projected_finish, some_far_future)
    []s, HTH, Massa (κς,πμ,πλ)
Re^2: (OT) Complex SQL Statement
by Pancho (Pilgrim) on Jul 23, 2008 at 19:55 UTC
    Ahh, the beauty of an elegant and concise solution...
Re^2: (OT) Complex SQL Statement
by boblawblah (Scribe) on Jul 24, 2008 at 15:23 UTC
    THANK YOU!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://699678]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2026-02-16 06:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.