Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> SQL Query

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: SQL Query
 Jami  Posted: Feb 15, 2007 01:40:51 AM

 Total Post: 7
 Joined: Feb, 2007






 hi,
i need to pick records which are in previous week.
if today is 16-feb. i need records from 5-feb to 11-feb.
i have date field in my table.
Can anyone help me out.

thanks
Jami

 Oracle Virus
Posted: Feb 15, 2007 02:47:59 AM  

 Total Post: 50
 Joined: Jan, 2007






 
Hi,
Its pretty simple to check that out. Just try this, you will get the result.

select col_name from table where date_col between to_date('5-feb-2006','dd-mon-yyyy') and to_date('11-feb-2006','dd-mon-yyyy');


this will show you the result, keep the appropriate col names and table name iin the query.

Regards,
Aneel Kanuri

 PK
Posted: Feb 15, 2007 06:11:24 AM  

 Total Post: 10
 Joined: Feb, 2007






 
hi Jami,

u can try this!!!

select col_names from table where date_col >= to_date('5-feb-2006','dd-mon-yyyy') and date_col <=to_date('11-feb-2006','dd-mon-yyyy');

 Oracle Virus
Posted: Feb 15, 2007 06:59:19 AM  

 Total Post: 50
 Joined: Jan, 2007






 
Hi PK,
What i said is the same and simplest way!!! I have never seen any proffessional splitting simple clause like this. (Ofcz I am not a proffessional in this SQL Field, Its just my hobby.)

Regards,
Aneel Kanuri

 Jami
Posted: Feb 19, 2007 12:07:16 AM  

 Total Post: 7
 Joined: Feb, 2007






 
hi all,
thanks for all the response.
This is kind of hard ocding the dates.
What exactly is:
I have to generate a report for the previous week.
requirement is i can fire the query on any day of the current week.
so have only current day in my hand.and i have to get all the records for previous week.

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi333
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software