Advertisement

07.27.2007 at 06:21PM PDT, ID: 22725802
[x]
Attachment Details

Why dont these SIMPLE queries work?

Asked by richardsimnett in MySQL

Hello,
I have two tables which have 100% varchar fields, I am trying to join them together based on a single varchar field. But it never returns a result.

Here is what I am doing:


select * from WV,WVCategories
where WV.CategoryID = WVCategories.ID;

select * from WV,WVCategories
where strcmp(trim(WV.CategoryID),trim(WVCategories.ID)) = 0;


Both return 0 results.

However, if I change the fields shown above to integers, the queries work fine. How do I make this work with the varchar fields? I have a bunch of tables (100+) that need to be joined in this way, and are only temporary. Im not interested in altering all the tables and fields.

Im using mysql 5.

Worth 500 points.

Thanks,
RickStart Free Trial
[+][-]07.27.2007 at 07:53PM PDT, ID: 19583460

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.27.2007 at 07:59PM PDT, ID: 19583472

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MySQL
Sign Up Now!
Solution Provided By: richardsimnett
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.27.2007 at 08:02PM PDT, ID: 19583480

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.27.2007 at 08:26PM PDT, ID: 19583532

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.30.2007 at 04:48AM PDT, ID: 19591658

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.02.2007 at 09:42PM PDT, ID: 19622626

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32