Zoom on query of queries

I use stand-alone ColdFusion 9

I'm still a little new to this, but I found code of exploration down that fits my needs for my application. It uses a query of queries which, to a certain extent, I understand. My problem is when I want to take down a few steps further. The first query lists products that are associated with related by-products. By clicking on a product, it will display a list of related subcategories. I would then each by-product a link to a detail page, but I don't know if my link of by-product code is correct, and I'm not sure what the page detail request should look like to show this specific detail of by-product. Here is the code I have so far:

The exploration down product page:

< cfquery name = "GetDetail" datasource = cachedwithin "mm_instance" = "1" >
SELECT products.productID, products.product, instance.instances
OF products, Instance, ProductInstance
WHERE products. ProductID = ProductInstance.productID AND ProductInstance.instanceID = instance.instanceID
< / cfquery >
< cfquery dbtype = "query" name = "zoom on" >
SELECT DISTINCT productID, product
OF GetDetail
ORDER BY product
< / cfquery >

< cfoutput query = "Zoom on" >
< table width = "100%" id = "box" >
< b >
< td valign = "top" width = "510" id = "prodname" > < a href = "Inst_List.cfm? ProductID = #DrillDown.ProductID # "> #DrillDown.product # < br > < /a > < table >"
< /tr >
< /table >
< / cfoutput >

By-product (or Instance) exploration to the bottom of the Page:

< cfquery name = "GetDetail" datasource = cachedwithin "mm_instance" = "1" >
SELECT products.productID, products.product, instance.instances
OF products, Instance, ProductInstance
WHERE products. ProductID = ProductInstance.productID AND ProductInstance.instanceID = instance.instanceID
< / cfquery >
< cfquery dbtype = "query" name = "zoom on" >
SELECT instances, productID
OF GetDetail
WHERE GetDetail.productID = #url.productID #.
ORDER BY product
< / cfquery >

< cfoutput query = "Zoom on" >
< table width = "100%" id = "box" >
< b >
< td valign = "top" width = "510" id = "prodname" > < a href = "Inst_Detail.cfm? productID = #DrillDown.productID #" > #DrillDown.instances # < /a > < table >
< /tr >
< /table >
< / cfoutput >

By-product of detail page:

Don't know what this query should look like

Thank you!

You are using too many requests.  On the first page, just select a different set of products and their identification card, unless you need the value of the instance for something else.  On your exploration down the page, you must select all products again.  Simply select one of the variable url.

Tags: ColdFusion

Similar Questions

  • query of queries case-sensitive

    Hello

    I have a question regarding this issue.  I am pulling data from an xml file and dump these data in the query of queries and their output.  The problem is when I try to order the CSA query, the stem will be high and fewer will be on the bottom.  Is it possible to sort them before the dump in query data?  Or ways around this?

    Thank you.

    functions upper() and lower() SQL function in q.

  • Query of queries: error when you try to fake Left Outer Join

    Hello

    I'm trying to reproduce a left outer join, combining two query of queries using a method I find here

    However, I get an error message...

    Here is the code I use...

    < cfquery dbtype = "query" name = "qry" >
    SELECT *.
    OF returnQry, returnQry2
    WHERE returnQry.mediumImage = returnQry2.mediumImage
    ORDER BY returnQry.name
    < / cfquery >

    < name cfquery = "returnQry3", dbtype = "#application.mx #" >
    SELECT *.
    OF trackmeanings t
    < / cfquery >

    < cfquery dbtype = "query" name = "endQry" >
    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE qry.name = returnQry3.sNameTrack

    UNION

    SELECT name, nameRcd, mediumImage, comments COUNT (sMessage)
    OF qry, returnQry3
    WHERE #qry.name # NOT IN (#QuotedValueList (returnQry3.sNameTrack) #)
    GROUP BY name, nameRcd, mediumImage
    < / cfquery >

    When I try to use the query output in a page, I get the error message "incorrect conditional expression, waiting for an a [as |]» null | between | in | "comparison condition.

    Anyone have any ideas?

    Thank you very much

    The items in the list should be cited.  Since you are using quotedvaluelist, it's weird that they aren't.  However, if you use cfqueryparam, list = Yes, you should have better luck.  Among other things, it will protect you against the apostrophe in names.

  • Error running query of queries

    Hello

    I am in the process of updating my site in CF5 to CF9 and I get a "query of query error" on the following code each time I have add the first point to my shopping cart. If I add a second element, the error disappears. Here are two pieces of keys to the code where I pull the item from the database information and then use the query requests to merge the query with the amount of shopping cart.

    <!-get-> Product Details

    < CFQUERY NAME='GetDetails'

    DATASOURCE = ' #request.ds # '

    Username = ' #request.dsuser # '

    PASSWORD = ' #request.dspass # ' >

    SELECT
    ItemNo,

    Agenda,

    Grades,

    Price,

    ImageSmall

    DE Products
    ItemNo IN (#QuotedValueList(GetCart.ItemNo) #)
    < / CFQUERY >

    <!-add the column "OrderQty"->

    < CFQUERY NAME="GetList" DBTYPE="query">

    SELECT
    GetDetails.ItemNo YOU ItemNo,

    GetDetails.Item point, AS

    GetDetails.Grades AS Grades,

    AS price, GetDetails.Price

    GetDetails.ImageSmall AS ImageSmall,

    GetCart.Quantity AS OrderQty

    DE GetDetails, GetCart
    GetDetails.ItemNo = GetCart.ItemNo
    < / CFQUERY >

    This is the error I get. The line number refers to the Q of Q above.

    Error running query of queries.

    Comparison = runtime exception.
    Comparison of Type incompatible Exception: on the left side and right side of the comparison operator "=" have incompatible types.
    Type of expression left side = "VARCHAR".
    Expression type side right hand = "DATE".

    I tried a lot of things affect a 'string' type to the right, but nothing seems to work.

    I would be very happy any help that I can get as I've spent countless hours trying to figure this.

    Thank you
    Steve

    Looks like the GetCart query is generated with functions to query coldfusion as opposed to a database query.  It also seems that the QueryNew function has the names of the fields, but not the types of data.  This means some trys to ColdFusion for the type of basic data on the first rows of data.

    Or it could be something else.

  • Can't find answer to a query of queries error

    Not only I saw this forum, but also google this problem, but the unfortunnately I have no chance to find the answer.

    I wrote this simple query:

    < cfquery name="test" dbtype="query">

    Select The SSN, date of birth de myquery where SSN <> '' OR Date of birth <>"

    < / cfquery >

    and I got this error:

    Error running query of queries.

    Exception of comparison when running <>.
    Unsupported Type comparison Exception: the <>operator does not support comparison between the following types:
    Type of expression left side = 'DOUBLE '.
    Expression type side right hand = "STRING".

    I tried the following and has not worked either, still got the same error.

    < cfquery name ="test" dbtype ="query">

    Select The SSN, date of birth de myquery

    NSS <> < cfqueryparam cfsqltype ="CF_SQL_VARCHAR" Value =""/ >

    OR Date of birth <> < cfqueryparam cfsqltype ="CF_SQL_VARCHAR" Value =""/ > < / cfquery >

    Ever met someone the same problem and know how to solve it?

    Select SSN, date of birth of myquery where cast (SSN to the varchar type) <> " OR cast (date of birth as varchar) <> "

  • Query question queries

    You can query a query created using queryNew()?

    When I try the following code, I get an error:

    "Query of queries syntax error.
    Meeting "qData. user. "Incorrect conditional expression, waiting for an a [as | null | between | in | comparison] condition."

    Code:

    < cfset qData = queryNew ("tool, user, community, fm01, fm02, fm03, fm04, fm05, fm06, fm07, fm08, fm09, fm10, fm11, fm12, fy") >
    < cfset temp = #queryAddRow (qData) # >
    < cfset temp = #querysetCell (qData, "tool", "empty") # >
    < cfset temp = #querysetCell (qData, "user", "Bob") # >

    < cfquery dbtype = "query" name = "chkQdata" >
    SELECT *.
    OF qData
    WHERE qData.user = 'Bob '.
    < / cfquery >

    I just tried the code you provided, adding two cfdump Tags (the first to empty the qData query and the second to empty the chkQdata query). Everything worked well exactly as you had it on Railo 3.1. It did not work (threw the error you got) on CF 8.0.1.

    If I deleted the WHERE clause of the query of chkQdata, it runs (no error) in CF 8.0.1.

    For that it works as you want in CF8, change the user column. This seems to be a keyword for CF8. While I didn't check exactly, if I change your original request to be 'empty' = tool, it runs. In addition, rename the column user usr generates the script runs correctly.

    Here is the code that I had to work in CF8 and Railo 3.1:

    SELECT *.

    OF qData

    WHERE the usr = "Bob."

  • Query of queries

    I am having trouble with the query of queries in CF5. I have included my select statement in the attached code.

    I want to be able to do now is to select totals of the original with a query of queries request. For example, I need to know my total return compared to my new visitors total visitors (for the love of the query, a new visitor is a person whose FirstVisitDate statement date range the user specified [attributes.start to attributes.end] and a return visitor is someone whose FirstVisitDate does nto fall within the specified range.)

    I tried something like:
    < cfquery dbtype = "query" name = "GetNewHits" >
    Select Count (Visitor)
    Of QueryVisitors
    Where FirstVisit
    Between #attributes.start #.
    and #attributes.end #.
    < / cfquery >

    The above query (when he returned to all results) returns all records in the original request (for me, it seems that the FirstVisit field doesn't recognize as a date field). Can anyone offer any suggestions? Thank you

    -Daniel Casper

    I wish I had the choice to upgrade, but the company is not apparent from a local server and our Web host is 2 releases from behind. I think I found a way to implement without however using Q of Q.

    I put an increment conditional when the results are displayed, which checks the date against my range of user and then increments a variable newhit if it corresponds to the range, or increments a variable returnhit if it is not. Until now it works fine. If someone needs it, the increment of conditional is:



    Thank you all for your suggestions.

  • Query of queries on 2 data sources

    I'm doing a query of queries on 2 different data sources. I run a gaming site and have a 2 programs that are used for tracking. One is written in php, by someone else, following members point State. The other, I wrote it in CF, allows members to set priorities in Treasury. Both are independent on my server. What I'm trying to do is set up so that the program I wrote to FC shows the number of points, each Member has. I know how interrogate separate tables, but how do I combine them? In addition, how can I set up so that it only shows members that match. that is, I want to assure you that if John Smith has 100 points, the query will show John Smith 100 points on my table. Here is what the query looks like I did. As you can see, I'm confused about and WHERE statements. I played with him last night and could not make it work. Thank you.

    You can try the same correction/idea of what I posted in thread http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=1&catid=7

    Copied/Pasted from this thread:

    You can read through the first query and add content to a query to temp attributing some kind of field and then read through the second query and add same temp with a kind of field to the query. Then do a query of this temp query.

  • Query of queries error

    I use the same data source to create a query of queries, but one of my questions is not recognized. The codes and messages are the following:

    You do not use the datasource with a query of query property
    tag. When you do a query of query you are dealing with record sets
    memory. Delete the "datasource" setting in the third tag.

  • Query of queries syntax error.

    Hi all

    I have the following query:

    < cfquery 'agent' datasource = name = 'Datasourcename' >
    SELECT * FROM quote where status = 'pending '.
    < isDefined ("form.agent") cfif >
    AND agent = ' #FORM.agent # '.
    < / cfif >
    < / cfquery >

    Then I have the following query of this query

    < cfquery name = "totalvalue" dbtype = "query" >
    SELECT total MySQL under the name OF the agent
    < / cfquery >

    However, I get the following error:

    Query of queries syntax error.
    Met «SUM (value.» List of incorrect selection,

    on line 20, which is:

    < cfquery name = "totalvalue" dbtype = "query" >

    now, I'm sure it's identical to what ive used before, but the error. totals query works fine when querying the database direct, only had this error when I changed it to query the master query.

    I appreciate any help in advance, that no matter how I look at I can't see whats wrong!

    In my view, that this value is a reserved word which originally is probably your current error. I would rename this column or alias it in your initial query. Also, I would like to add value WHERE IS NOT NULL to your Q-Q to cover your NULL values.

    Phil

  • Query of queries problem.

    Hello

    I want to access the data from two different data sources, without a common key. For example:

    Table1:

    Select stmts

    Table 2

    Select stmts

    Table12 <! - joining two tables to access the data from the tables - >

    Select table1.x, table2.y

    where? = ?????

    How to deal with these features?

    Thanks in advance,

    Vijay.

    PPS

    If you try to join two tables in two databases may not (and may not be made to) see each other.  You can basically do the same thing with the query in the query.  You would simply query the appropriate data in each database.  Then, you must use a query of query block ... , replacing variables with the data in the other table in them for table names in SQL.

    Just be awary query of query has a rather limited Assembly capability and cannot do the inner joins.

  • Need help with query of queries

    I have the query 'almost' out there, but I don't know exactly how to proceed.

    I need all of the recrods meets the criteria of the query AppliedLicense.

    But not all records will have a match in the ApprovedLicense query.

    In the MergedData query I hope to have the column with date_exp filled with ApprovedLicense data when there is a football match but NULL if there is not a match.

    The code below, of course, only returns records where there is a match in the two data sources, but I have no idea how to proceed.

    Thanks for any help.

    You could do it yourself with functions of list if I hope, you do not have too many files. After executing the second query:


    You have now 2 lists of coordinates

    Subsequently during the processing of the first query,





  • Query of queries (QofQ) escaped character problem

    Hi all

    I am trying to run a query or queires (QofQ) and I do a LIKE comparison which finds support ([]) characters in the string, but ColdFusion ignores the media. How can I escape the character of support? So far, I couldn't escape the percentage based on the Docs sign live ColdFusion. The error message I get when I run the query below is:

    «"" "Invalid escape sequence.»»»" Pairs of valid sequence for this escape character are: "------%", or "\".

    This is the query:
    < cfquery dbtype = "query" name = "getLogs" >
    SELECT *.
    OF GetLogs
    WHERE Description LIKE '\[User:#UserID#\]% %' ESCAPE ' \'
    < / cfquery >

    Thanks for your help!

    What of it?

    WHERE my Description LIKE ' % [[] user: #UserID #] %'

  • Query of queries to test for date null or empty

    I have problems with this request (in a function). The last condition in where clause must verify if a blank date or no, then check against the current date (which is fine), im aware that the syntax is wrong, but asked if someone could fix it for me to make it work.

    < name cfquery = "filterQuery" dbtype = "query" maxrows = "#arguments.top #" >
    Select * from getAllSaved
    where
    workFlowStatusId = < cfqueryparam cfsqltype = "CF_SQL_INTEGER" value = "" #application.const.WORKFLOW_LIVE # "/ >"
    and
    dateArchive > < cfqueryparam cfsqltype = 'CF_SQL_DATE' value = "#now ()" # "/ >"
    and
    dateLive < = < cfqueryparam cfsqltype = 'CF_SQL_DATE' value = "#now ()" # "/ >"
    and
    (dateExpiry is null or dateExpiry = ") or dateExpiry > < cfqueryparam cfsqltype = 'CF_SQL_DATE' value =" #now () "#" / > "
    < / cfquery >

    I feel stupid, although I would put a Fiver on having tried!

    Thank you

  • Using NVL in the query in the query resulting in error

    I always use CF8 and Oracle 11 G back.

    When I use NVL in the query in the query, I got error... I can't use NVL to check the value null? Help, please

    Here are my codes:

    < name cfquery = "GetC2" datasource = "#Trim (application." OracDSN) #">"

    SELECT CamID2, rel2_2, p_ln2, p_fn2, ins, l_year

    OF prt_temp

    WHERE Ins = 'CC '.

    AND l_year = '1481'

    AND NVL (Child_LN2,' ') <>' '
    AND NVL (Child_FN2,' ') <>' '

    < / cfquery >

    < cfif GetC2.Recordcount NEQ 0 >
    < cfquery name = "CheckRel2C2", dbtype = "QUERY" >
    SELECT CamID2, rel2_2
    OF GetC2
    WHERE NVL (Rel2_2,' ') <>' '
    AND NVL (p_ln2,' ') = ' '
    AND NVL (p_fn2,' ') = ' '
    AND Ins = 'CC '.
    AND l_year = '1481'
    < / cfquery >

    < / cfif >

    The error:

    Run database query error.

    Query of queries syntax error.

    Met «NVL (Rel2_2.» Incorrect conditional expression, waiting for an a [as | null | between | in | comparison] condition,.

    NVL is an Oracle function and it is not available in ColdFusion query of query.  If you try to check the values null, use IS NULL or IS NOT NULL.  Then

    WHERE NVL (Rel2_2,' ') <> ' '

    AND NVL (p_ln2,' ') = ' '

    AND NVL (p_fn2,' ') = ' '

    becomes

    WHERE Rel2_2 IS NOT NULL

    AND p_ln2 IS NULL

    AND p_fn2 IS NULL

    -Carl V.

Maybe you are looking for