Diffrent where clause
I have a table which has the following structure:
id
user
month_start # stores numbers from 1 to 12
month_stop # stores numbers from 1 to 12
data_start # store calendaristic data
data_stop # store calendaristic data
I need to select all the user and id like this
If the data_start and data_stop is diffrent that '0000-00-00':must be like this
select id, user from table where data_start < curdate() and data_stop > curdate()
if the month_start and month_stop <> '0' then it use this:
select id, user from table where month_start < month(curdate()) and month_stop > month(curdate())
But, when the data_start and data_stop <> '0000-00-00' and month_start and month_stop <> '0' it must do like this:
select id, user from table where data_start < curdate() and data_stop > curdate() and month_start < month(curdate()) and month_stop > month(curdate())
Subject
Written By
Posted
Diffrent where clause
July 19, 2005 06:23AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.