Ask a Question related to Coldfusion Database Access, Design and Development.
-
Anderson11983 #1
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
-
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. -
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... -
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... -
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... -
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... -
paross1 #2
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
-
ctrl+alt+delete #3
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
-
Anderson11983 #4
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



Reply With Quote

