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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 6th, 2005, 05:17 PM
jpixel jpixel is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 47 jpixel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 41 sec
Reputation Power: 4
How can you link cfoutput queries to get various bits of information?

I have a table, bids. It is very simple: vehicle id, user id and highest bid.

I need a page that informs the user how the bidding is going.

It needs to display each distinct vehicle id, the highest bid for that car (out of all the bids the users have placed) and the number of users that have bid for that vehicle.

This should be straight-forward but I have no idea where to start. There's no way I can get all this in one query, so obviously I will need several, but then how can I use info from one in the other?

for example:

<!--- gets distinct vehicle ids --->
<cfquery name="displaybidID" datasource="hj">
select distinct id from bids
</cfquery>

<!--- gets highest bid for each vehicle --->
<cfquery name="maxBid" datasource="hj">
select MAX(highBid) from bids where id = <<the id from the above query!! >>
</cfquery>

Also these all have to be in a table, i got it listing distinct vehicle id's in a row each, but then how can I enter the extra info such as highest bid and no of users bid in the fields right next to each distinct number...i'm confused

Reply With Quote
  #2  
Old March 6th, 2005, 06:19 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
I think a simple group by would do it.

<!--- gets highest bid for each id --->
<cfquery name="maxBid" datasource="hj">
select MAX(highBid), id from bids
group by id
</cfquery>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old March 6th, 2005, 06:22 PM
jpixel jpixel is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 47 jpixel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 41 sec
Reputation Power: 4
thanks man, but then what about counting user ids to see how many people bid for a vehicle (id)??

Reply With Quote
  #4  
Old March 6th, 2005, 07:32 PM
fidi fidi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 4 fidi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 14 sec
Reputation Power: 0
You could always query the first query. Google querying queries in coldfusion.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > How can you link cfoutput queries to get various bits of information?


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 | 
  
 

IBM developerWorks




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