SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast hpaum99's Avatar
    Join Date
    May 2003
    Location
    Bakersfield CA
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question need help with WHERE clause

    I'm trying to write an SQL statement that will only show the records that have an ID number that are even numbers.

    This is the code that I have tried...
    SELECT empid FROM employees WHERE MOD(empid,2) = 1

    but I get this error back..
    Syntax error (missing operator) in query expression 'MOD(empid,2) = 1'.

    What am I doing wrong? Or is there a better way to do this?



    NEVERMIND I GOT IT! WOOHOO
    Last edited by hpaum99; Jun 25, 2004 at 10:34.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,275
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    what you should do is post what the solution is

    nothing more frustrating than someone coming to this page because they searched for exactly the same symptoms only to find a "nevermind" message...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast hpaum99's Avatar
    Join Date
    May 2003
    Location
    Bakersfield CA
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    good point..

    This is what I ended up using and it worked fine...

    SELECT * FROM employees WHERE [empid]MOD 2 =1

    (I'm using an access database)

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,275
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    w00h00!

    thanks
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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