Results 1 to 2 of 2

Thread: Where, In, and Between functions together?

  1. #1
    Join Date
    Apr 2012
    Posts
    1

    Where, In, and Between functions together?

    Hi, I am very new to SQL and put this together trying to emulate how Access writes the code, but Access says there is a missing operator. Please assist!

    WHERE (((JPL.class)="TNO") AND ((JPL.q)>25) AND ((JPL.per_y) in(Between 272 And 278,Between 287 And 293,Between 244 And 251.5,Between 324.5 And 334.5, Between 405 And 421.5, Between 202.5 And 207.5, Between 217.5 And 222.5, Between 391 And 399, Between 435 And 445, Between 292 And 298, Between 376 And 374, Between 381 And 389, Between 768.3 And 799.7, Between 572.5 And 586, Between 599 And 623.4, Between 486 And 500)))

    I think I may be using a combination of In and Between incorrectly...

  2. #2
    Join Date
    May 2006
    Posts
    407
    This worked for me:
    Code:
    SELECT JPL.Class, JPL.q, JPL.per_y
    FROM JPL
    WHERE ((JPL.Class="TNO") AND (JPL.q>25) AND 
    ((JPL.per_y Between 272 And 278) OR 
       (JPL.per_y Between 287 And 293)));
    I tried to get the "shorthand" version to work, and it does not look like Access likes it any other way than the repeating of the "JPL.per_y"

Posting Permissions

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