close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

multiple tables for details page

Thread began 8/01/2014 2:54 am by Mark | Last modified 8/01/2014 5:28 pm by Jason Byrnes | 551 views | 7 replies |

Mark

multiple tables for details page

Ray helped me out today during a paid support session with adding data from two tables on a details page. He joined the "toys" table with the "MIT" table to bring in the "MIT_Link" with this code:

$query_rsDetails = sprintf("SELECT toys.*, MIT_Link FROM toys LEFT OUTER JOIN MIT ON MIT.MIT_ID = toys.MIT_ID WHERE productID = %s", GetSQLValueString($colname_rsDetails, "int"));

Now, I need to add data from two other tables - a "dc_Link" from a table called "dcAdaptor" and a "footpad_Link" from a table called "footpad". I cannot figure out how to incorporate those new elements in the code.

Sign in to reply to this post

Jason ByrnesWebAssist

You need to add additional joins to the SQL.

I Would need to know the table structures and how they relate to offer any more advice.

Sign in to reply to this post

Mark

OK, the MIT, dcAdaptor, and footpad tables all have just two columns - the unique ID and the Link ("MIT_ID" and "MIT_Link", "dcAdaptor_ID" and "dcAdaptor_Link" etc.) The main "toys" product table contains a column for each of the unique IDs. The common element between the tables is therefore the unique ID. Does that tell you enough?

Sign in to reply to this post

Jason ByrnesWebAssist

"The main "toys" product table contains a column for each of the unique IDs"

what are the column names?

i need the exact names of the columns. . .

Sign in to reply to this post

Mark

The ID for the MIT table is called "MIT_ID". The ID for the dcAdaptor table is called "dcAdaptor_ID". The ID for the footpad table is called "footpad_ID".

The column name for MIT in the toys table is called "MIT_ID". The column name for dcAdaptor in the toys table is called "dcAdaptor_ID". The column name for footpad in the toys table is called "footpad_ID".

Sign in to reply to this post

Jason ByrnesWebAssist

OK, so the origianl SQL without the where clause is:

SELECT toys.*, MIT_Link
FROM toys
LEFT OUTER JOIN MIT ON MIT.MIT_ID = toys.MIT_ID

edit that to:
SELECT toys.*, MIT_Link, dcAdaptor.*, footpad.*
FROM toys
LEFT OUTER JOIN MIT ON MIT.MIT_ID = toys.MIT_ID
LEFT OUTER JOIN dcAdaptor ON dcAdaptor.dcAdaptor_ID = toys.dcAdaptor_ID
LEFT OUTER JOIN footpad ON footpad.footpad_ID = toys.footpad_ID

leave the where clause untouched.

Sign in to reply to this post

Mark

Thanks so much Jason!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

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