View previous topic :: View next topic
|
Author |
Message |
lara
New User
Joined: 31 May 2006 Posts: 5
|
|
|
|
What is the query to find out all employee IDs whose birthday fall today ? |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Lara,
Please give table defination |
|
Back to top |
|
|
sihanature Warnings : 1 New User
Joined: 01 Sep 2005 Posts: 33
|
|
|
|
Yeah,
If you give info about the table you using, we can provide the query using
Current date .
Regards, |
|
Back to top |
|
|
umavivekanand
New User
Joined: 26 Apr 2006 Posts: 5 Location: Banglore
|
|
|
|
Hi
i guess this shd work with some modifications to suit ur table name & field names
Select empid from emp_table where bday=current date;
the date format for the Current date is YYYY-MM-DD
pls let me know if this works !
Thx
uma |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
Just a small correction,
Select empid from emp_table where bday=current_date;
it should be current_date instead of 'current date'
Thanks,
Parikshit. |
|
Back to top |
|
|
lara
New User
Joined: 31 May 2006 Posts: 5
|
|
|
|
Hi,
Table name : Employee
Columns : Emp_name & Emp_Bdate(mmddyyyy)
There is a small catch in it as current_date built-in function will give the full year. The years wont match because employee's birth year wud not be current year.
Thanks,
Lara |
|
Back to top |
|
|
steve
New User
Joined: 24 Mar 2005 Posts: 16 Location: Long Island
|
|
|
|
I just tried the following query on CA- DATACOM. Hope it works for DB2 too.. pls try..
select emid from employee WHERE month(EMBDAT) = month(CURRENT TIMESTAMP) and day(embdat) = day(current timestamp) fetch first 20 rows only |
|
Back to top |
|
|
|