|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
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
|
|||
|
|||
|
database querying useing max(value) for each return
Any help you can give for this would be great.
What I am trying to do is connect 2 tables and display the highest number from one of them. Right now I have 2 tables one contains the name and description of a gallery and the other containing an image name and a Date for that gallery. What I need to do is connect the 2 table using the gID for the gallery info and pGallery for the images and list all the galleries that have images in it, but I also want to display the most recent image for each gallery based on the date. I am trying to do this using just one query, any suggestions? I have tried it few different ways already but the best I have gotten is it showing only one gallery. Thank You |
|
#2
|
|||
|
|||
|
Something like:
select g.gallaryName, g.gallaryDescription, gi.imageName, gi.imageDate from gallary g, gallaryImages gi where g.gid = gi.gid and gi.imageDate = (select max(gi2.imageDate) from gallaryImages gi2 where gi2.gid = gi.gid)
__________________
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
|
|||
|
|||
|
Quote:
That worked great with a slight modification to the where statment. Thank You |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > database querying useing max(value) for each return |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|