SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old April 26th, 2004, 09:02 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Output problems with Multiple Query Set

Here is what I want to achieve.....
Firstly, I take a query from the round table and check for all empty entries. This is the weekly submisisons table, so basically I am checking for all those who have yet to enter their weekly picks.

So my first Query looks something like this...

<cfquery datasource = "#request.dsn#" name = "usersOutstanding">
SELECT team_name
FROM round_#round_number#
WHERE margin_1 = ''
</cfquery>

Next I want to take all those users who haven't entered anything for this week yet and collect their information from the client table (which initially stored phone numbers, contact details etc upon signup) and output in a table.

<cfquery datasource = "#request.dsn#" name = "clientDetails">
SELECT *
FROM client
WHERE team_name = '#users.team_name#'
</cfquery>


But this only gives me the first users information and I want ALL users from the previous query. I tried using loop but to no avail. All help greatly appreciated.

adieu
Mark

Reply With Quote
  #2  
Old April 27th, 2004, 12:08 AM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Using queries from queries, I managed to get this working....

<!--- Retrieve all client info --->
<CFQUERY NAME="Clients" DATASOURCE="#request.dsn#">
SELECT *
FROM client
</CFQUERY>

<!--- Retrieve those who failed to submit --->
<CFQUERY NAME="userMargin" DATASOURCE="#request.dsn#">
SELECT team_name
FROM round_#round_number#
WHERE margin_1 = '1-9'
</CFQUERY>

<!--- pull the client info for those who failed --->
<CFQUERY NAME="combined" DBTYPE="query">
SELECT team_name, phone, email
FROM Clients,userMargin
WHERE Clients.team_name=userMargin.team_name
</CFQUERY>


and in the display page

<cfoutput query="combined">
#team_name#, #phone#, #email#<br />
</cfoutput>

--------------------------------------

I guess my question now is this - is there any other way to achieve this using less code?

adieu
Mark

Reply With Quote
  #3  
Old April 27th, 2004, 07:21 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 25th Plane (17000 - 17499 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,344 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 5 Days 8 h 27 m 14 sec
Reputation Power: 891
yes, with a join
Code:
select client.* 
  from client
inner 
  join round_#round_number#  R
    on client.team_name 
     = R.team_name
 where R.margin_1 = ''
__________________
r937.com | rudy.ca

Reply With Quote
  #4  
Old April 27th, 2004, 05:31 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
that's perfect, ty! I did however need to add another column to the round table for #round_number# to make the join process easier.

adieu
Mark

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Output problems with Multiple Query Set


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway