queryNew() joining to physical table

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

  1. #1

    Default queryNew() joining to physical table

    Can I join a query object (a query created with queryNew()) to a physical
    database table? It only works if I return the physical resultset and then join
    the two with a query of queries.

    <cfset tempQuery = queryNew('field_1)>
    <cfset temp = QueryAddRow(tempQuery)>
    <cfset temp = querySetCell(tempQuery,'field_1','data',1>

    <!--- this won't work --->
    <cfquery datasource="this_ds" name="getrealData">
    select realData from realTable, tempQuery
    where realTable.realData = tempQuery.field_1
    </cfquery>

    <!--- but this works --->
    <cfquery datasource="this_ds" name="getrealData">
    select realData from realTable
    </cfquery>

    <cfquery name="join_tables" dbtype="query">
    select *
    from tempQuery,getrealData
    where tempQuery.field_1= getrealData.realData
    </cfquery>

    Any help would be greatly appreciated!



    DannoParker Guest

  2. Similar Questions and Discussions

    1. queryNew and SQL?
      Quick question: Is there any way to access the query results of self-built queries (created with queryNew(), queryAddRow(), etc.)with SQL? For...
    2. Joining Paths or joining two shapes
      Hi, I have drawn threeleaves with the pen tool (closed paths). I would like to join these leaves to make a flower into which I want to place an...
    3. moving the physical log
      According to the IDS 9.4 docs, I can move the physical log like this: set IFX=D:\IFMXDATA\ol_bronco copy nul D:\IFMXDATA\ol_bronco\physpace.001...
    4. Physical Logging performance
      Ruediger Yes, this is something I have tried to achieve, it tends to reduce disk I/O to the Physical Log and make the I/O more efficient. I'm...
    5. Could not load type VTFixup Table from assembly Invalid token in v-table fix-up table.
      We are getting this error after clearing the web.config of database infomation - even after using the wizard to re-enter the information. I could...
  3. #2

    Default Re: queryNew() joining to physical table

    I wouldn't think so. A regular query against a physical database table takes place in the database, which knows nothing about CF query objects residing in CF memory.
    mxstu Guest

  4. #3

    Default Re: queryNew() joining to physical table

    No, you cannot query both the database and QoQ at the same time. The Datasource
    details specified within the CFQUERY tag must apply to all the tables being
    queried.

    If you don't need the data out of the CF query but need to retrieve data based
    on its values, you should be able to do something like this:

    SELECT RealData
    FROM RealTable
    WHERE RealDataField IN (#ValueList(tempQuery.tempDataField)#)

    But if you need to do a proper join then I think your 2nd bit of code is the
    way to go - put real query into CF query and then do the join using QoQ. NB.
    QoQ only supports up to 3 table joins I belive.

    HTH

    Zoe

    zoeski80 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