Help needed with Joining 2 Queries together

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

  1. #1

    Default Help needed with Joining 2 Queries together

    hi all.

    i've got the following two queries and i'd like to combine them into one, and
    i just can't figure it out. hoping someone here can get the old grey-matter
    working again :)

    basically i would like to display the dealerName (from the 1st query) that is
    equal to the dealerID (in the 2nd query).

    hope this makes sense!

    thanks in advance for any replies.

    regards,

    Neil



    <cffunction name="GetDealers" access="public" output="false"
    returntype="query" hint="Get current list of dealerships.">
    <cfset var qGetDealers = "" />
    <cfquery name="qGetDealers" datasource="#variables.dsn#">
    SELECT dealerID,
    dealerName
    FROM tblDealers
    ORDER BY dealerName DESC
    </cfquery>
    <cfreturn qGetDealers />
    </cffunction>

    <cffunction name="GetOrderSummaries" access="public" output="false"
    returntype="query" hint="Get current summary list of orders.">
    <cfset var qGetOrderSummaries = "" />
    <cfquery name="qGetOrderSummaries" datasource="#variables.dsn#">
    SELECT orderID,
    orderDateTime,
    customerID,
    dealerID,
    orderNoCustomer
    FROM tblOrders
    ORDER BY orderDateTime DESC
    </cfquery>
    <cfreturn qGetOrderSummaries />
    </cffunction>

    neilsytner Guest

  2. Similar Questions and Discussions

    1. Queries Of Queries Single Quote Problem
      When using queries of queries I'm having the following issue. Select Company_ID From qry_MyQuery Where Company_NM = 'MyString''s' <----...
    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. joining paths
      I'm a freshman to Freehand and I can't figure out how to join open paths to a path once it has been closed. If it is possible can you fill it with...
    4. Joining these two queries
      Can anyone help me to join Query 1 to Query 2 cheers rob Query 1 ------------- SELECT * FROM
    5. Urgent Help Needed ! JDBC driver crashes after 200 queries
      Hi all, We have a major problem and need help. I've written a testing program which has several pieces of sql which we execute in a loop. After 191...
  3. #2

    Default Re: Help needed with Joining 2 Queries together

    figured it out...

    <cffunction name="GetOrderSummaries" access="public" output="false"
    returntype="query" hint="Get current summary list of orders.">
    <cfset var qGetOrderSummaries = "" />
    <cfquery name="qGetOrderSummaries" datasource="#variables.dsn#">
    SELECT O.orderID,
    O.orderDateTime,
    O.customerID,
    O.dealerID,
    O.orderNoCustomer,
    D.dealerID,
    D.dealerName
    FROM tblOrders AS O,
    tblDealers AS D,
    WHERE O.dealerID = D.dealerID
    ORDER BY O.orderDateTime DESC
    </cfquery>
    <cfreturn qGetOrderSummaries />
    </cffunction>

    neilsytner 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