#1
  1. No Profile Picture
    Newbie wannabe extrodanaire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Location
    stoke
    Posts
    322
    Rep Power
    17

    sql statemen with multiple inner joins


    Hi,

    I was wondering if there were are sql/colfusion gurus that can help me please. Im trying to make this sql statement to be in proper coldfusion syntax and am stuck(as i newbie to coldfusion) and appreciate any and all help

    Thanks

    Andy


    Code:
    <cfquery name="AttachedToTextCount" datasource="#caller.nimoirdb#" maxrows="1">
    SELECT count(LnA.ID) FROM links LnA
      INNER JOIN pageHasText phT on LnA.id = phT.linkID
      INNER JOIN itemPage pA on phT.pageID = pA.id
      INNER JOIN tracking tA on pA.trackingID = tA.id
    
    WHERE (LnA.linkType = "download" AND LnA.linkTo = <cfparam name="#objectID#" cfsqltype="CF_SQL_CHAR"> AND tA.status  NOT IN "removed", "purged")
    
    </cfquery>
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2005
    Posts
    9
    Rep Power
    0
    Well 1st cfparam will mess you up it should be
    Code:
     <cfqueryparam 
                            value="#LastName#" 
                            cfsqltype="CF_SQL_VARCHAR" 
                            maxlength="17">
    Also max rows not needed count will return only 1 result

    Mark Holm

    Comments on this post

    • kiteless agrees
  4. #3
  5. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    972
    Mark is right on both counts (no pun intended...har har).
  6. #4
  7. No Profile Picture
    Newbie wannabe extrodanaire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Location
    stoke
    Posts
    322
    Rep Power
    17
    Thanks for your help guys.

    Iv'e made the chanegs that you suggested - is that everything or is there more that needs to be done?

    Thanks again for your help

    Andy

IMN logo majestic logo threadwatch logo seochat tools logo