Answered
How to do this? results from 2 querys
Hi all,
I'm stuck with the following problem.
I need to get all the info from two querys / tables and show them in one table.
I guess I need to do this in a loop or so as I can not do a query in a query.
This is what I have, but does not work as it's always showing the same name.
<cfquery name="getAccounts" datasource="#db2use#">
SELECT *
FROM banners
</cfquery>
<cfoutput query="getAccounts">
<cfset advertPID = #advertPID#>
</cfoutput>
<cfquery name="ListUsers" datasource="#db2use#">
SELECT *
FROM useraccount
WHERE PIDID = '#advertPID#'
</cfquery>
<cfoutput query="ListUsers">
<cfset UserAccount = #name#>
</cfoutput>
<cfoutput query="getAccounts">
name: #name# | advertPID: #advertPID# <br />
</cfoutput>
Both ListUsers and getAccounts have a lot of data.
Anyone here who can show me how to do this?
Thank you.
I'm stuck with the following problem.
I need to get all the info from two querys / tables and show them in one table.
I guess I need to do this in a loop or so as I can not do a query in a query.
This is what I have, but does not work as it's always showing the same name.
<cfquery name="getAccounts" datasource="#db2use#">
SELECT *
FROM banners
</cfquery>
<cfoutput query="getAccounts">
<cfset advertPID = #advertPID#>
</cfoutput>
<cfquery name="ListUsers" datasource="#db2use#">
SELECT *
FROM useraccount
WHERE PIDID = '#advertPID#'
</cfquery>
<cfoutput query="ListUsers">
<cfset UserAccount = #name#>
</cfoutput>
<cfoutput query="getAccounts">
name: #name# | advertPID: #advertPID# <br />
</cfoutput>
Both ListUsers and getAccounts have a lot of data.
Anyone here who can show me how to do this?
Thank you.
