query question

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

    query question

    I'm a relative noob so if this is the wrong group, please point me to the
    right place...

    I have a table that contains events, including a date (date/time field)
    for that event. I'd like to construct a query that will return all events
    that happened in a list of years.

    Something along the lines of

    select * from t_events where eventDate in (1999,2001,2006 )

    Is there a way to do that?

    TIA,
    Bruce
  • timmg

    #2
    Re: query question

    Assuming that your event date is a number you've nailed it. If it's a
    date field try

    select * from t_events where year([eventDate]) in (1999,2001,2006 )

    You can type the SQL directly or use the query builder.

    Good luck

    Tim Mills-Groninger

    On Jun 19, 9:24 am, Bruce Bowler <bbow...@bigelo w.orgwrote:
    I'm a relative noob so if this is the wrong group, please point me to the
    right place...
    >
    I have a table that contains events, including a date (date/time field)
    for that event.  I'd like to construct a query that will return all events
    that happened in a list of years.
    >
    Something along the lines of
    >
    select * from t_events where eventDate in (1999,2001,2006 )
    >
    Is there a way to do that?
    >

    Comment

    • Salad

      #3
      Re: query question

      Bruce Bowler wrote:
      I'm a relative noob so if this is the wrong group, please point me to the
      right place...
      >
      I have a table that contains events, including a date (date/time field)
      for that event. I'd like to construct a query that will return all events
      that happened in a list of years.
      >
      Something along the lines of
      >
      select * from t_events where eventDate in (1999,2001,2006 )
      >
      Is there a way to do that?
      >
      TIA,
      Bruce
      You might want something like
      select * from t_events where year(eventDate) in (1999,2001,2006 )

      16 Candles

      Comment

      • Bruce Bowler

        #4
        Re: query question

        On Thu, 19 Jun 2008 08:58:02 -0700, Salad wrote:
        You might want something like
        select * from t_events where year(eventDate) in (1999,2001,2006 )
        Cool... Didn't know I could stick the year function in there. Works like
        a champ!

        Thanks to both you and timmg.

        Bruce

        Comment

        Working...