multiple inner joins

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default multiple inner joins

    Hi,

    im a newbi to coldfusion and i need to multiple inner joins between tables in
    a database - some one has give me the sql version(from an old stored procedure)
    and i need to convert it to coldfusion syntax etc.

    I've had a go and now im stuck and i was hoping someone can help me and point
    in the right direction - if included what ive done :(

    Appreciate any and all help

    Thanks
    Andy



    <cfquery name="AttachedToFlashCount" datasource="#caller.nimoirdb#">

    SELECT count(LnC.ID) FROM links LnC
    INNER JOIN pageHasFlash phF on LnC.id = phF.linkID
    INNER JOIN itemPage pC on phF.pageID = pC.id
    INNER JOIN tracking tC on pC.trackingID = tC.id

    WHERE (LnC.linkType = "download" AND LnC.linkTo = <cfqueryparam
    name="#objectID#" cfsqltype="CF_SQL_INT"> AND tC.status NOT IN "removed",
    "purged")
    </cfquery>


    Anderson11983 Guest

  2. Similar Questions and Discussions

    1. JOINs instead of AND
      Where do I go to learn how to do JOINs instead of using multiple ANDs in a WHERE clause? I hear a JOIN is faster, and I am all for speed in a query.
    2. Query problem - multiple left joins??
      I have an employee table, and an organization table. The employee table contains an ouID link which always has a match in the org.table. The...
    3. Multiple Joins in one Query for CFGRID
      Hello, I am tring to combine all 4 queries into 1 so that it will work in a CFGRID and it's a little beyond my SQL experience. I have all this...
    4. SQL help on joins
      I'm getting bogged down in figuring out how to do joins on 3 tables. The three tables are Institution, stats and signoff. Institution_ID is the...
    5. Help on Multiple JOINS
      Paul Eaton wrote: Yes, unless it's Access, which is really picky about using parentheses to group the joins. If you're using Access, use the...
  3. #2

    Default Re: multiple inner joins

    The only thing that I see that is obviously wrong is this:

    LnC.linkType = "download"
    and
    tC.status NOT IN "removed", "purged"

    try

    LnC.linkType = 'download'
    and
    tC.status NOT IN ('removed', 'purged')

    instead

    Phil


    paross1 Guest

  4. #3

    Default Re: multiple inner joins

    If you have a stored procedure that works, stick with that and use the
    <cfstoredproc> tag.

    "Anderson11983" <webforumsuser@macromedia.com> wrote in message
    news:d583ru$rv0$1@forums.macromedia.com...
    > Hi,
    >
    > im a newbi to coldfusion and i need to multiple inner joins between tables
    > in
    > a database - some one has give me the sql version(from an old stored
    > procedure)
    > and i need to convert it to coldfusion syntax etc.
    >
    > I've had a go and now im stuck and i was hoping someone can help me and
    > point
    > in the right direction - if included what ive done :(
    >
    > Appreciate any and all help
    >
    > Thanks
    > Andy
    >
    >
    >
    > <cfquery name="AttachedToFlashCount" datasource="#caller.nimoirdb#">
    >
    > SELECT count(LnC.ID) FROM links LnC
    > INNER JOIN pageHasFlash phF on LnC.id = phF.linkID
    > INNER JOIN itemPage pC on phF.pageID = pC.id
    > INNER JOIN tracking tC on pC.trackingID = tC.id
    >
    > WHERE (LnC.linkType = "download" AND LnC.linkTo = <cfqueryparam
    > name="#objectID#" cfsqltype="CF_SQL_INT"> AND tC.status NOT IN "removed",
    > "purged")
    > </cfquery>
    >
    >

    ctrl+alt+delete Guest

  5. #4

    Default Re: multiple inner joins

    Thanks for your help guys,

    Besides make the alterations that paross1 suggested does everything else look
    fine?
    I can't put them in a stored procedure tag as ive got to convert all nof our
    ctored procedures to .cfc.

    Thanks Again for your help

    Andy


    Anderson11983 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139