|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
thanks man, but then what about counting user ids to see how many people bid for a vehicle (id)??
|
|
#4
|
|||
|
|||
|
You could always query the first query. Google querying queries in coldfusion.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > How can you link cfoutput queries to get various bits of information? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|