Query Help Needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    Query Help Needed

    Hi

    I have a table of job ids and dates. What query will get me the job id of
    the earliest job after yesterday i.e. a job that is either today, or if
    there is no job today, a job that is as soon as possible after today.

    Thanks

    Regards


  • MGFoster

    #2
    Re: Query Help Needed

    John wrote:[color=blue]
    > Hi
    >
    > I have a table of job ids and dates. What query will get me the job id of
    > the earliest job after yesterday i.e. a job that is either today, or if
    > there is no job today, a job that is as soon as possible after today.[/color]

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    You may wish to try:

    SELECT job_id
    FROM table_name As j
    WHERE job_date = (SELECT MAX(job_date) FROM table_name
    WHERE job_date <= Date() )

    --
    MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
    Oakland, CA (USA)

    -----BEGIN PGP SIGNATURE-----
    Version: PGP for Personal Privacy 5.0
    Charset: noconv

    iQA/AwUBQhlN1IechKq OuFEgEQK1wwCfYJ 6K9kriKnQ1QMr9l OS5mbqdna0An2hq
    AEx6LU7spglFv9I v2kfL704c
    =dDjl
    -----END PGP SIGNATURE-----

    Comment

    Working...