close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

combining 2 tables using a 3rd table as the link table.

Thread began 7/28/2014 9:44 am by Christopher West | Last modified 8/01/2014 2:23 pm by Christopher West | 992 views | 13 replies

Christopher WestCommunity Expert

Hi Jason, hmm I see your point about that inner join needs both records matching...it seems that left outer join doesnt work either.

I was wondering in your SQL your using FROM Products first...(but since that products and feedback are both equals in this scenerio wouldnt I need to start with SELECT featured (and then use a join for both products and feedback tables to connect to featured table).

I have previously tried different versions of SQL but without luck.

this is currently my SQL

php:
$basefile = basename ( $_SERVER["REQUEST_URI"] );


mysql_select_db($database_dinkydb, $dinkydb);
$query_rsFeatured = "SELECT * FROM products LEFT OUTER JOIN featured ON products.ProductID = featured.FeaturedTypeID LEFT OUTER JOIN feedback ON feedback.FeedbackID = featured.FeaturedTypeID WHERE FeaturedLocale = '$basefile'";
$rsFeatured = mysql_query($query_rsFeatured, $dinkydb) or die(mysql_error());
$row_rsFeatured = mysql_fetch_assoc($rsFeatured);
$totalRows_rsFeatured = mysql_num_rows($rsFeatured);



As stated before I was told the only way to solve this is to use sub-queries - but i havent had much expeirence in this.

Side Note: to be clear the 2 tables Products and Feedback have no relationship with each other. All im doing is wanting to mix up the displaying of random products and random feedback (which IDs are are stored in the Featured table) so the only way to do this is to stored product ids and feedback ids in one single table so thay when i do a recordset repeat region i can have them displaying randomly.

I was told that: Sub queries can only bring back 1 row on the sub query but are great for calculating a total.

A sub query on a join will behave like a union query but the fields don't have to match. It will return you all the rows from both tables.

The alternative is to have one field brought back as an array of all records as a coma separated list and simply loop over that list.

So I think the way to solve this issue is to use a sub query, but in context to my tables as noted above I dont know how.

Any other ideas?
Chris

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...