date sql query

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

date sql query

Post by greedyisg00d »

I have a schedule table and it has 3 fields by default namely e_name, date_from, date_to. For example

e_name = greedyisgood
date_from = 2009/03/05
date_to = 2009/03/10

In my search page I have 2 fields date_from and date_to. What I want is when the user sets a date in the search for example.

date_from = 2009/03/01
date_to = 2009/03/06

The record of greedyisgood will not be shown since he has already a schedule on the date entered by the user.

Any sample query so that I can try it. Thanks
CanMikeF1
Forum Newbie
Posts: 8
Joined: Wed Feb 18, 2009 7:32 am

Re: date sql query

Post by CanMikeF1 »

I'm not really clear on what your asking but if you mean you would like a select statement that returns all records but excludes any records by e_name = greedyisgood then:

select * from table where e_name != 'greedyisgood';

The conditional '!=' means not equal to.

Is this what your want?
Post Reply