Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Unanswered: IF statement in SQL Query

    I'm not sure if this is possible, but its worth asking. I was wondering if it was possible to do something like this in mySQL (Im just making this up out of my head)

    SELECT f.*, IF(f.buyable, s.cost, '') as cost
    FROM file as f
    IF f.buyable THEN
        LEFT JOIN subscription as s ON s.subscriptionid = f.subscriptionid
    END IF
    Please note the IF...THEN... statement.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    perhaps you could explain in words what you are trying to do? | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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