close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Join tables

Thread began 11/02/2010 8:06 am by danny405167 | Last modified 11/02/2010 3:56 pm by Jason Byrnes | 1950 views | 8 replies |

danny405167

Join tables

I have 2 tables, customers and quotes. I have joined the customers table with my quote table. Below is the query that I am using.

SELECT quotes.quoteID, quotes.customerID, customers.customerName
FROM quotes
LEFT OUTER JOIN customers ON quotes.customerID = customers.customerID

I get the following error "Column 'customerID' in where clause is ambiguous" when I searched by either customer ID or customer name. I tried using Includes, Begin with, and = from dataAssist wizard when creating the search form.

I am only getting the error when I used the LEFT OUTER JOIN clause.

Sign in to reply to this post

Jason ByrnesWebAssist

please send a copy of your page so I can examine the full code.

Sign in to reply to this post

danny405167

Join tables files

Here are the files you requested

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

Jason ByrnesWebAssist

the data assist search code will need to be edited to clarify the table names.


for example, change line 25 of the results page:

php:
$WADbSearch1->addComparisonFromEdit("customerID","S_customerID","AND","Begins With",1);




to:

php:
$WADbSearch1->addComparisonFromEdit("quotes.customerID","S_customerID","AND","Begins With",1);
Sign in to reply to this post

danny405167

Error is gone but...

is there a way to search with either customer ID or name? I get results when I entered customer ID but I get zero results when I entered the customer name. I changed the "Begin with" to "Includes".

Thanks for fixing the error message.

Sign in to reply to this post

danny405167

I just need to know if it can be done with join tables

Is it possible for dataAssit to create a search page to search either by customer ID or customer NAME? I have joint customer table to quote table.

Customer Table
customerID (primary key)
customerName


Quote Table
quoteID (primary key)
customerID (foreign key)

QUERY
---------------
SELECT quotes.quoteID, quotes.customerID, customers.customerName
FROM quotes
LEFT OUTER JOIN customers ON (quotes.customerID = customers.customerID)

Can you please point me in the right direction where I can make the adjustment.

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to edit the data assist search and add a parameter to use the customer name column, current;y you only have a parameter for the customer ID column and none for the customer name column.


the wizard wont do this for you automaticly, you need to edit the behavior after the search is created.

Sign in to reply to this post

danny405167

Sorry to bother you again

Do you mean create a parameter like this

Customer ID parameter
------------------------ $WADbSearch1->addComparisonFromEdit("quotes.customerID","S_customerID","AND","Includes",0);


Customer Name parameter
-------------------------- $WADbSearch1->addComparisonFromEdit("customers.customerName","S_customerID","AND","Includes",0);

Please let me know if this is right, if not then I just live with search by customer ID only.

Sign in to reply to this post

Jason ByrnesWebAssist

you should create a new form element for the costomer name on the search form, and use that in the perameter:

say the new form element is named "S _customerName":

php:
$WADbSearch1->addComparisonFromEdit("customers.customerName","S _customerName","AND","Includes",0);
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...