Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I think the forum is a great idea, especially for those of us in consulting engineering. Keep up the good work!..."

Geography

Where in the world do Tek-Tips members come from?

extract month to order, from calculated field

Tracey (Programmer)
12 Mar 03 16:20
Hi guys
 
I have a query which returns a calculated field of type date
 
i would like to order my records by the month of that field
 
something like:

  select distinct pe.commencedate, sn.skillid, s.name sname, sn.timeperiodid, tp.weeks, p.name pname, p.companyid, (pe.commencedate + (weeks * 7)) as RequiredBy
from personemployment pe
join person p on p.personid = pe.personid
join skillneeded sn on sn.employmentid = pe.employmentid
left join timeperiod tp on tp.timeperiodid = sn.timeperiodid
join skill s on s.skillid = sn.skillid
where p.companyid = 1
and ((pe.commencedate + (weeks * 7)) >= '3/12/03' and (pe.commencedate + (weeks * 7)) <= '3/12/04')
and sn.skillid not in
(select skillid from skillattempt where (personid = p.PersonID and skillid = sn.skillid
and result = 'P' and (validto is null or validto > '3/12/03')))
                order by extract(month from 8)
 

only firebird1.0 doesnt like extract there.  is there a way i can do this?
 
Tracey
Software Developer / Web Master
Logis
tracey@logis.co.nz
(025) 213-1065
Otto (Programmer)
13 Mar 03 3:35
Hi!

Put the 'extract(...' into the start of the select statement (to simplify the 'order') and use the field number only in the 'order'.

select distinct extract(month from (pe.commencedate+(weeks*7))), ...
order by 1

Otto

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close