Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong with my sql?
Message
 
 
To
20/08/2003 08:33:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00821726
Message ID:
00821728
Views:
22
>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.


What's error message? Most likely TCodeWord and TCodeName have different structure and UNION requires that field list in the selects match.

>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?


What are the values stored in lcCodeTitle and lcCodeAuthor variables?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform