Results 1 to 10 of 10
  1. #1
    Join Date
    May 2005
    Posts
    37

    Unanswered: Date funtion query

    Hi Guys

    I am having probs with my queries the first query i am having problems is


    is finding the the people who have worked for more then 15 years? using the hire colume.


    My second query is finding the first day of the month in which each person was hired? Heres what i have done for my query but still no luck

    select Empno, ename, deptno, LEAST(hiredate)
    from emp

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >My second query is finding the first day of the month in which each person was hired?
    Wouldn't that always be the 1st of that month & therefore hardcoded as '01'?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    May 2005
    Posts
    37
    Im not sure how i am suppose 2 do that

    I tried it as but cant get it to work?

    select ename, job, TO_CHAR(hiredate, '01',MONTH,YYYY') HIREDATE from emp
    Order by hiredate

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    IMO, it appears to me that you are unwilling or incapable of reading the fine SQL Reference manual to actually see how to properly construct a valid SQL statement.
    http://download-west.oracle.com/docs...b14200/toc.htm
    >TO_CHAR(hiredate, '01',MONTH,YYYY')
    here are a couple of free clues:
    1) TO_CHAR takes only 2 arguments (not 4).
    2) single quote marks must be used in pairs & you have 3 in your feeble attempt
    If you can't generate valid SQL statements, you should consider a different course/major.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    May 2005
    Posts
    37
    IS that all you do is just take the mick out of people and post links information. How often you go out? it shoowssss

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    I am out with friends right now.
    With a laptop & WIFI I can be online any time I am not asleep.
    I posts links to answers for those are willing to find answers which are readily available rather than be dependent upon the kindness of strangers to spoonfeed answers which may or may not be correct.

    *PLONK*
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  7. #7
    Join Date
    May 2005
    Posts
    37
    Normally when i go out, i leave my laptop in the house, and talk to peope. Rather then diss people online. Obviously you rather judge someone before you help them. I am a kind person and I help people. I dnt go around telling people they have feeble minds. Who are you to judge. If you cant help me dnt bother.

    I learn better if I see examples first. Thats how I have learnt.

  8. #8
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >I learn better if I see examples first.
    From which example did you find this code? TO_CHAR(hiredate, '01',MONTH,YYYY')?
    The manual (previously provided link) contains many fine & working examples that I am sure you'd benefit from learning them.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  9. #9
    Join Date
    May 2005
    Posts
    37
    >From which example did you find this code? TO_CHAR(hiredate, '01',MONTH,YYYY')?

    If Im not mistaken you were the one who said use 01

    I'l try it

  10. #10
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Quote Originally Posted by Khan05
    Hi Guys

    I am having probs with my queries the first query i am having problems is


    is finding the the people who have worked for more then 15 years? using the hire colume.


    My second query is finding the first day of the month in which each person was hired? Heres what i have done for my query but still no luck

    select Empno, ename, deptno, LEAST(hiredate)
    from emp
    select Empno, ename, deptno, trunc(hiredate,'month')
    from emp
    where hiredate <= add_months(sysdate, (15 * 12 * -1)) ;
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •