#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    1
    Rep Power
    0

    Why is this SQL code not working?


    This is just a very simple code, and if you could help point out why it's not working, it'd be much appreciated.

    "
    USE Fruit_list
    SELECT
    a.oranges,
    a.pears,
    fruitcount = count(*),
    apples,
    b.banana,
    a.dragonfruit
    FROM Fruits a
    JOIN Fruits b
    ON a.banana = b.banana
    WHERE dragonfruit between ('20090508') and ('20110508')
    AND ActiveFlg = 1
    GROUP BY
    a.oranges,
    a.pears,
    apples,
    b.banana,
    a.dragonfruit
    "

    Thank you
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,212
    Rep Power
    4279
    please define "not working"
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Posts
    41
    Rep Power
    10

    Without an error code


    it's not much help - what's the error code

    But if I had to guess randomly - I'd say your between statement is messed up - you're representing your numbers as strings, remove the parentheses and the quotation marks and try again.

IMN logo majestic logo threadwatch logo seochat tools logo