Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 MYSql error when selecting from multiple tables, a

Author  Topic 

Maddocks
Starting Member

8 Posts

Posted - 2006-04-18 : 15:13:39
i have posted this here because it is concerning mysql, here is my problem:

i have setup a search script which searches one table and this works fine. Now, i want the script to search two tables, the tables have the same structure and i want the script to select from the "Name" column in both tables. I have tried using a select statement for two tables but receive this error: Column 'Name' in where clause is ambiguous. I heard that this means the script doesnt know which table to search as they both have the same column name. I want it to search both. Here is my select script:

select * from downloads_anti ,downloads_multi where Name like \"%$trimmed%\"

any suggestions would help me greatly thanks.


http://pchelpworld.awardspace.com < Free PC/PSP Forums - no signup required

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2006-04-18 : 15:23:23
Then you need to us an OR statement

Where dbo.downloads_anti.name Like \"%$trimmed%\" Or dbo.downloads_multi.name \"%$trimmed%\"

Jim
Users <> Logic
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-04-18 : 15:26:40
Here's the corresponding thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64900

Tara Kizer
aka tduggan
Go to Top of Page
   

- Advertisement -