Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
One Works, One Doesn't
Message
From
26/06/2006 16:29:19
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
One Works, One Doesn't
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01131819
Message ID:
01131819
Views:
53
This works to pull all that match between two tables in SQL Express 2005:

lcSelect = "SELECT " ;
+" b.* " ;
+" FROM Table1 a INNER JOIN Table2 b on LTRIM(RTRIM(a.unitcode)) = LTRIM(RTRIM(b.unitcode))" ;
+" AND LTRIM(RTRIM(a.unittype)) = LTRIM(RTRIM(b.usertyped))" ;
+" WHERE a.inactive = 'TRUE'"

?SQLEXEC(lnconnhandle, lcselect, 'myresults')

However, now I want to do the same but match only pull where a.untypeid=sqlresults.untypeid

sqlresults.untypeid is a field in the table currently open table. Untype.untypeid should match it.

However, the code below returns -1:

lcSelect = "SELECT " ;
+" b.* " ;
+" FROM table1 a INNER JOIN table2 b on LTRIM(RTRIM(a.unitcode)) = LTRIM(RTRIM(b.unitcode))" ;
+" AND LTRIM(RTRIM(a.unittype)) = LTRIM(RTRIM(b.usertyped))" ;
+" WHERE a.inactive = 'TRUE' AND a.untypeid = sqlresults.untypeid"

?SQLEXEC(lnconnhandle, lcselect, 'myresults')
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform