SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with sql qurery - invalid column name

    Hello all, im trying to execute the following:

    SELECT * FROM BasketDetails b
    INNER JOIN DesignDetails d ON b.CustomisedID = d.DesignID INNER JOIN Products p ON d.ProductID = p.ProductID INNER JOIN AffiliateMarkupPrice am ON am.DocumentID = d.DocumentID
    WHERE b.UserID = gnrac055rnj3x555jfwakt45 AND b.CheckoutID = 0

    Hwever, when I execute, I get the following error:

    "invalid column name 'gnrac055rnj3x555jfwakt45'"

    Any ideas?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    gnrac055rnj3x555jfwakt45 is a column name

    'gnrac055rnj3x555jfwakt45' is a string value

    you want the latter

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

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Actually, he wants a GUID and he probably should be using parameters to not worry about escaping things.


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
  •