|
 |
sql_language thread: Birthday==>AGE
Message #1 by oranee@y... on Thu, 8 Feb 2001 18:23:45
|
|
--0-1448364748-981723394=:59689
Content-Type: text/plain; charset=us-ascii
select * where year(birthdate) => year(getdate)-40 or year(bithdate) <= year(getdate)-30
I rarher think that the between would work as well
select * where year(birthdate) between year(getdate)-40 and year(getdate)-30
Igor Braginsky <anhel11@y...> wrote:
If a user will enter in your field data like this:
30-40 or 40-50 and the data is going to be sent to
database with this look, you could add two columns
more to your table: Min and Max. After that, write a
store procedure or SQL statement in your programm like
this:
update table ..the name of your table
set Min = Age(name of your column)
when case 30-40 then 30
when case 40-50 then 40
end,
set Max = Age
when case 30-40 then 40
when case 40-50 then 50
end
And you could search a person using "between":
Select * from your table where age between 30 and 40
Igor
--- oranee@y... wrote:
> Dear All!
> I don't know how to do SQL for searching
> persons' Info who have the range of ages that I
> entered from the Form.. In my database has Birthday
> field. The users will enter the range of ages into
> my HTML page..such as 30 to 40...
> Please help!
> Thanks very much in advance
> Oranee
>
---------------------------------
Do You Yahoo!?
- Get personalized email addresses from Yahoo! Mail Personal Address - only $35 a year!
|
|
 |