Domanda

I keep getting an empty result set back from my query when it should not be.
Here is my first table- person

1   u_id    bigint(20) 
2   first   varchar(15)                     
3   last    varchar(15) 

second table- test

1   u_id    bigint(20)          
2   score   smallint(6)     

Query I'm using-

SELECT score
FROM person, test
WHERE last ='Roberts'   ;   

It works if I use a query-

SELECT score
FROM person, test
WHERE first ='Tim'  ;  

Thanks

È stato utile?

Soluzione

How about the following query:

SELECT score 
FROM person p
INNER JOIN test t ON p.u_id = t.u_id
WHERE Trim(p.last) ='Roberts'

and:

SELECT score 
FROM person p
INNER JOIN test t ON p.u_id = t.u_id
WHERE Trim(p.first) ='Tim'
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top