{"id":513,"date":"2012-04-12T21:20:52","date_gmt":"2012-04-12T16:20:52","guid":{"rendered":"http:\/\/www.esearing.com\/v2010\/?p=513"},"modified":"2012-04-12T21:21:04","modified_gmt":"2012-04-12T16:21:04","slug":"coldfusion-query-of-queries-to-join-two-datasets","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2012\/04\/coldfusion-query-of-queries-to-join-two-datasets\/","title":{"rendered":"Coldfusion Query of Queries to Join two datasets"},"content":{"rendered":"<p>I had an issue where I needed to join data from two different datasets with out having an ODBC connection created by the admin.<br \/>\nI ran the two queries in thier respective databases then used query of queries to join them. This should work with differing types of databases like Oracle vs SQL Server.<\/p>\n<p>Example (without brackets):<br \/>\n<code><br \/>\n\/\/ query dataset 1<br \/>\ncfquery name=\"q1\" dataset=\"ds1\"<br \/>\nselect emp_id, first name, last name<br \/>\nfrom tbl<br \/>\n\/cfquery<\/p>\n<p>\/\/query dataset 2<br \/>\ncfquery name=\"q2\" dataset=\"ds2\"<br \/>\nselect emp_id, salary<br \/>\nfrom tbl<br \/>\n\/cfquery<\/p>\n<p>\/\/ now use query of queries to merge the results<br \/>\ncfquery name=\"q3\" dbtype=\"query\"<br \/>\nselect q1.emp_id, q1.first_name, q1.lastname, q2.salary<br \/>\nfrom q1, q2<br \/>\nwhere q1.emp_id = q2.emp_id<br \/>\n\/cfquery<\/p>\n<p>\/\/output results<br \/>\ncfdump var=\"#q3#\"<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had an issue where I needed to join data from two different datasets with out having an ODBC connection created by the admin. I ran the two queries in thier respective databases then used query of queries to join &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2012\/04\/coldfusion-query-of-queries-to-join-two-datasets\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,16,24],"tags":[],"class_list":["post-513","post","type-post","status-publish","format-standard","hentry","category-code","category-coldfusion","category-snippets-quick-code-tips-for-single-elements-attributes-or-details"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/comments?post=513"}],"version-history":[{"count":3,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/513\/revisions"}],"predecessor-version":[{"id":517,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/513\/revisions\/517"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}