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"