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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Problem with my join query

Thread began 6/03/2013 9:31 pm by blakebenjamin327842 | Last modified 6/06/2013 11:27 am by Jason Byrnes | 3032 views | 26 replies |

blakebenjamin327842

Problem with my join query

I am setting up my Data Assist Details page and in my database "product" table I have field entitled "QualityID" this field is the reference for the product's quality types. The "quality" table has the following two fields that the product table is referencing: "QualityID" and a "QualityName" field.

On my details page it is showing the "QualityID"( i.e., "2") number, however I want show the actual "QualityName" (i.e., "Eclipse") that it references . How do I accomplish this? I tried the code below however it only shows me the name from the first QualityID ignoring the that is should be should the name from the second QualityID.

Here is the code I used. Am I missing something?

SELECT product.*, quality.QualityName
FROM product INNER JOIN quality ON product.QualityID = quality.QualityID

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the details page please.


The details page should already have a recordset on it that is filtering the correct details based on the URL Variable, add the join to that recordset instead of creating a new one.

Sign in to reply to this post

blakebenjamin327842

Attached is the details page. Thanks for your help.

B

Sign in to reply to this post

Jason ByrnesWebAssist

YEeah, so like i said, there is already the WADAproduct recordset on this page. and that recordset is already set to filter the product.ProductID on the URL variable that is passed in.

instead of creating a second recordset, just edit the existing one to add your join.

in the server behaviors panel, double click the WADAproduct recordset to edit it, In Advanced mode, change it from:

SELECT * FROM product WHERE ProductID = colname

to:
SELECT product.*, quality.QualityName FROM product INNER JOIN quality ON product.QualityID=quality.QualityID WHERE ProductID = colname


Notice that colname used in the WHERE is a variable defined as:
Name: colname
TYPE: Integer
Default Value: -1
Runtime value: $_GET['ProductID']

the $_GET['ProductID'] URL variable tells the details page which product to load

Sign in to reply to this post

blakebenjamin327842

Jason - I have roughly 5 ID's that I have to join... how do I combine multiple Join correctly? Here's what i came up with based on your previous message. Of course it doesn't work.

SELECT product.*, quality.QualityName, country.CountryName, copyright.CopyrightName, materials.MaterialName, palettes.PaletteName
FROM product INNER JOIN quality ON product.QualityID=quality.QualityID
FROM product INNER JOIN county ON product.CountryID= country.CountryID
FROM product INNER JOIN copyright ON product.CopyrightID=copyright.CopyrightID
FROM product INNER JOIN materials ON product.MaterialID=materials.MaterialID
FROM product INNER JOIN quality ON product.PaletteID=palettes.PaletteID
WHERE ProductID = colname

Sign in to reply to this post

Jason ByrnesWebAssist

the FROM keyword should only occur once. The INNER JOIN is a part of the FROM clause:

SELECT product.*, quality.QualityName, country.CountryName, copyright.CopyrightName, materials.MaterialName, palettes.PaletteName
FROM product
INNER JOIN quality ON product.QualityID=quality.QualityID
INNER JOIN county ON product.CountryID= country.CountryID
INNER JOIN copyright ON product.CopyrightID=copyright.CopyrightID
INNER JOIN materials ON product.MaterialID=materials.MaterialID
INNER JOIN palettes ON product.PaletteID=palettes.PaletteID
WHERE ProductID = colname

Sign in to reply to this post

blakebenjamin327842

I'm getting a syntax error - this is what I put in.

This is what I put in:

SELECT product.*, quality.QualityName, country.CountryName, copyright.CopyrightName, palettes.PaletteName
FROM product
?INNER JOIN quality ON product.QualityID=quality.QualityID
?INNER JOIN country ON product.CountryID= country.CountryID
?INNER JOIN copyright ON product.CopyrightID=copyright.CopyrightID
?INNER JOIN palettes ON product.PaletteID=palettes.PaletteID
WHERE ProductID = colname

Sign in to reply to this post

Jason ByrnesWebAssist

there should not be question marks in front of INNER JOIN

SELECT product.*, quality.QualityName, country.CountryName, copyright.CopyrightName, materials.MaterialName, palettes.PaletteName 
FROM product
INNER JOIN quality ON product.QualityID=quality.QualityID
INNER JOIN county ON product.CountryID= country.CountryID
INNER JOIN copyright ON product.CopyrightID=copyright.CopyrightID
INNER JOIN materials ON product.MaterialID=materials.MaterialID
INNER JOIN palettes ON product.PaletteID=palettes.PaletteID
WHERE ProductID = colname
Sign in to reply to this post

blakebenjamin327842

The Question marks just showed up in the copy and paste process here. I'm no longer getting the syntax error, however it's not pulling from the dbase any longer at all. I attached the page again.

Please advise.

Thanks

Attached Files
details_page_V2.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post
loading

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