Querying two datasources, but how?

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

  1. #1

    Default Querying two datasources, but how?

    Datasource HelpDesk - Tables: HelpDeskList A, Volunteers B,
    Datasource Employee - Tables: Employee C.

    A.Emailto, A.Entry_ID, A.Name
    B.Name, B.Email
    C.Notify, C.Email

    closeticket = a.entry_id get a.emailto
    a.name = b.name get b.mail
    a.emailto = c.email where notify = yes

    when ticket closes, get the 'email to' and send email if the person's employee
    record has notify set to yes.include email of ticket closer, ticket id (entry
    id)

    help help please

    <!--- <cfquery name = "onNotify" datasource = "HelpDesk">
    select a.notify, b.emailto, b.name, c.Vemail
    from emptbl a, Help_Desk_List b, TechsTbl c
    where b.EntryID = #Close_ticket# and b.name = c.name and a.notify = 'Yes'
    </cfquery> --->

    <!--- <cfoutput query = "onNotify">
    <cfif notify is "Yes">
    <cfmail to="#Emailto#@firstbankak.com" from="Helpdesk@FirstbankAK.COM"
    subject="Help Desk issue ###close_ticket# resolved by #name#"
    server="10.1.100.202">
    To better help us serve our customers you have volunteered to complete a
    survey rating our quality of service.
    Please take a moment to fill out the survey at the link below.


    [url]http://fbak.firstbankak.com/helpdesk_test/new/emp/survey.cfm?ticket=#close_ticke[/url]
    t#

    We appreciate your time, and value your input.

    Any questions you'd like to ask directly? <a href="mailto:#Vemail#">
    </cfmail>
    </cfif>
    </cfoutput> --->

    Captain Ru Guest

  2. Similar Questions and Discussions

    1. Use CF Datasources outside CF
      I need to create a JSP on the coldfusion server, and access coldfusion datasources in that JSP. Is there anyway to do this in CF6.1 or CF7. ...
    2. Dynamic Datasources?
      I am porting an app from PHP to CF. The app requires the functionality to perform queries on different databases. I cannot utilize the CF Admin as...
    3. Querying two datasources (MS ACCESS)
      Using a database that holds the job ticket information, I need to create an email notification checking against a different database (employee...
    4. CFMX Datasources
      To my understanding, previous versions of Coldfusion did not allow you to connect to an Oracle datasource. I was wondering if CFMX Server has this...
    5. accessing two different datasources
      I need to connect to 2 dfferent datasources that are in two different servers. Example: I need to move data from one table on server 1to a table...
  3. #2

    Default Re: Querying two datasources, but how?

    What database are you using ?

    If it's an enterprise db, then you should be able to select from more than one
    db using the single dsn

    If it's 2 ms access db's then you will need to use query od queries.

    Ken

    The ScareCrow Guest

  4. #3

    Default Re: Querying two datasources, but how?

    At least for Oracle you can create aliases on the db level for your user specified in the DSN, and the aliases can even point to a separate instance of Oracle on a separate machine
    yalta Guest

  5. #4

    Default Re: Querying two datasources, but how?

    They are two access databases, but the thing is, I dont' know HOW to query two different datasources, syntax-wise.

    i.e.
    <cfquery datasource = "1" datasource2 = "2" name = "dblDS">
    ?
    Captain Ru Guest

  6. #5

    Default Re: Querying two datasources, but how?

    here's a quick one:

    <CFQUERY NAME="q1" DATASOURCE="#yourDSN#">
    SELECT P.yourfield, SU.UserFirstName & ' ' & SU.UserLastName AS UserFullName
    FROM [A full path to an .mdb file].Users SU INNER JOIN Table1 P ON
    SU.UserID = P.UserID
    </CFQUERY>

    HTH

    --
    Tim Carley
    [url]www.recfusion.com[/url]
    [email]info@NOSPAMINGrecfusion.com[/email]
    Mountain Lover Guest

  7. #6

    Default Re: Querying two datasources, but how?

    Interesting Tim, did not know you could do that.

    I would have used QoQ

    <cfquery name="qryHelpDesk" datasource="dsn">
    Select EmailTo, Entry_ID, A.Name, Email
    From HelpDeskList A Inner Join Volunteers B On A.EmailTo = B.Email
    </cfquery>
    <cfquery name="qryEmployee" datasource="dsn1">
    Select Notify, Email
    From Employee
    </cfquery>
    <cfquery name="qryCombine" dbtype="query">
    Select *
    From qryHelpDesk, qryEmployee
    Where qryHelpDesk.Email = qryEmployee.Email
    </cfquery>

    The above is assuming that the common key field is the Email address

    Ken


    The ScareCrow 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