close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Search returning multiple results based on database foreign key table

Thread began 8/08/2017 4:18 pm by tmcbinc99963 | Last modified 8/15/2017 2:19 pm by tmcbinc99963 | 1113 views | 10 replies

tmcbinc99963

Example: there are nine listings in the foreign key table. Three with product #10 that are greases; three with product #15 that are gear oils and three with product #10 that are engine oils.

The results should show one #10 grease & engine oil, and one #15 gear oil.
The results show one #10 grease, grease, grease, engine oil, engine oil, engine oil, and #15 gear oil, gear oil, gear oil.

It looks like the product is showing correctly, but not the lubes. I've tried multiple combinations of GROUP BY and Group_Concat, but the lube results are always the same. I have a recordset using GROUP BY on another page working properly (though it SELECTS from a foreign key table, rather than a parent table like the one I'm having issues with. Tried changing the SELECT * FROM prod to FROM prod type (the foreign key table), but with no difference. Query below:

SELECT *, Group_Concat(Lube) AS LubeCats
FROM prod LEFT OUTER JOIN prodtype ON prod.ID = prodtype.ProdIDType LEFT OUTER JOIN lubetype ON prodtype.LubeID = lubetype.LubeTypeID LEFT OUTER JOIN prodsize ON prod.ID = prodsize.ProdSizeID LEFT OUTER JOIN contsize ON prodsize.ContSizeID = contsize.ContID LEFT OUTER JOIN Tech_DS ON prod.ID = Tech_DS.TDS_ID LEFT OUTER JOIN industry ON industry.IndustryID = prodtype.IndustryTypeID
GROUP BY ID

If I need to post this for further troubleshoot, let me know. I'll need to update the Db first.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...