Paradox Community

Items in pnews.paradox-development

Subject:Re: SQL Update Error
Date:Tue, 22 Aug 2017 08:50:50 -0400
From:"Larry DiGiovanni" <nospam@nospam>
Newsgroups:pnews.paradox-development
Larry DiGiovanni wrote:

> Your syntax looks correct.

One more thing:  If there isn't a matching row in t2 for each t1.icn, the 
unmatched rows will be update to NULL.

If this is not what you want to happen - if you only want the matched rows 
updated, you need to add WHERE EXISTS logic:

(untested)

UPDATE ':PRIV:__Sql_run148.db' t1
SET t1.'pph' = (SELECT  FIRST(t2.'PPh')
FROM ':PRIV:__sql_run147.db' t2
WHERE   t1.'icn' = t2.'icn')
WHERE exists (SELECT NULL FROM ':PRIV:__sql_run147.db' t3 WHERE t1.icn = 
t3.icn)

--
Larry DiGiovanni 


Copyright © 2004 thedbcommunity.com