General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
What's wrong with my sql?
dear all,
anybody can help me? what's wrong with my sql?
select * ;
from library!TCodeWord ;
where ccode like alltrim(lccodetitle) ;
union ;
select * ;
from library!TCodeName ;
where ccode like alltrim(lccodeauthor) ;
order by 1 ;
into cursor crsWord
if i run that sql there is an error message. then i change it with sql command below:
SELECT DISTINCT tBooks.cTitle, tBooks.cBookID;
FROM library!tBooks
INNER JOIN library!tBookWord;
INNER JOIN library!tCodeWord;
INNER JOIN library!tBooksName;
INNER JOIN library!tCodeName ;
ON tBooksName.cWord = tCodeName.cWord ;
ON tBooks.cBookID = tBooksName.cBookID ;
ON tBookword.cWord = tCodeWord.cWord ;
ON tBooks.cBookID = tBookWord.cBookID;
WHERE tCodeName.cWord LIKE alltrim(lcCodeAuthor);
OR (tCodeWord.cWord LIKE alltrim(lcCodeTitle));
ORDER BY tBooks.cTitle
INTO CURSOR crsBooks
when i run that sql the output are records that match only with this command:
tCodeWord.cWord LIKE alltrim(lcCodeTitle)
and ignore this command:
tCodeName.cWord LIKE alltrim(lcCodeAuthor);
why is that?
cheer,
Gloria
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only