Will Tomlinson wrote:
> I'm trying to run a search query on two tables. tblproductimages is a many
> table with a FK- prodmodelcode dropped from tblprodmodelcodes. So there can
> more than one image for a given model. How can I pare down the images to one
> image per model?
Does it matter which image? If not:
SELECT
code.prodmodelcode,
code.prodmodeltitle,
code.prodsellprice,
MAX(image.imagename)
FROM
tblprodmodelcodes code INNER JOIN tblproductimages image
ON code.prodmodelcode = image.prodmodelcode
WHERE
tblprodmodelcodes.prodmodeltitle LIKE '%#FORM.search#%'
OR
tblprodmodelcodes.prodmodeldescription LIKE '%#FORM.search#%'
GROUP BY
code.prodmodelcode,
code.prodmodeltitle,
code.prodsellprice
Jochem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware: a new and convenient web-based time tracking application. Start
tracking and documenting hours spent on a project or with a client with Logware
today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191455
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54