Geeks Talk

Prepare for your Next Interview




question

This is a discussion on question within the SQL forums, part of the Databases category; suppose enp table has 20 records .there i want to retrieve records i.e employees having date of birth as 1 st day of the month or last day of ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-05-2008
Banned
 
Join Date: Feb 2008
Location: bangalore
Posts: 32
Thanks: 9
Thanked 2 Times in 2 Posts
jayanth511 is on a distinguished road
question

suppose enp table has 20 records .there i want to retrieve records i.e employees having date of birth as 1 st day of the month or last day of month
Reply With Quote
The Following User Says Thank You to jayanth511 For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 03-05-2008
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 447
Thanks: 20
Thanked 54 Times in 54 Posts
susarlasireesha is on a distinguished road
Re: question

Try this
select * from employee where to_char(dateofbirth,'dd') in ('01',to_char(last_day(dateofbirth),'dd'));

Last edited by susarlasireesha : 03-05-2008 at 06:13 AM.
Reply With Quote
  #3 (permalink)  
Old 03-05-2008
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,432
Thanks: 8
Thanked 126 Times in 113 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: question

Quote:
Originally Posted by jayanth511 View Post
suppose enp table has 20 records .there i want to retrieve records i.e employees having date of birth as 1 st day of the month or last day of month
Before posting these kind of questions please post what / how you have tried from your side to solve it and if you are facing any problem. That will be more interactive.
Reply With Quote
  #4 (permalink)  
Old 10-21-2008
Junior Member
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
kamal12345 is on a distinguished road
Re: question

select * from employee where to_char(dateofbirth,'dd') in ('01',to_char(last_day(dateofbirth),'dd'));
Reply With Quote
  #5 (permalink)  
Old 10-31-2008
Junior Member
 
Join Date: Oct 2008
Location: Chennai
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
Sharavanan is on a distinguished road
Wink Re: question

Quote:
Originally Posted by jayanth511 View Post
suppose enp table has 20 records .there i want to retrieve records i.e employees having date of birth as 1 st day of the month or last day of month


Hi Jayanth..
Please write a procedure for your requirement like the 1 st day of month. The procedure should contain the variable @temp(@temp stores the data for the day of the query, like @temp=select day(DOB) from emp). Now you can check the condition)

I think it may help you but you check the result by using trial end error method.


Thank You.


Regards,

Sharavanan S
Reply With Quote
  #6 (permalink)  
Old 4 Weeks Ago
Contributing Member
 
Join Date: Nov 2008
Location: Chennai
Posts: 93
Thanks: 0
Thanked 9 Times in 9 Posts
amitpatel66 is on a distinguished road
Re: question

SELECT * FROM emp where (TRUNC(hire_date) = TRUNC(hire_date,'MM') OR TRUNC(hire_date) = TRUNC(LAST_DAY(hire_date)))
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
HR question sakshi_2801 Brainteasers 2 2 Weeks Ago 01:50 AM
HR question sakshi_2801 Companies 5 09-21-2008 05:19 PM
Question Manoj.Oracle Oracle Apps 2 03-10-2008 08:54 AM
Question padmakrishna Java 0 01-22-2008 04:04 PM
Question shitalpatil Brainteasers 3 03-08-2007 07:32 AM


All times are GMT -4. The time now is 08:47 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved