Trying to create UPDATE with nested queries

Posts   
 
    
msimpson
User
Posts: 2
Joined: 12-Oct-2005
# Posted on: 12-Oct-2005 20:54:19   

I am looking for a way to translate a complex update statement into LLBLGen code and am having some difficulty.

The update statement has subqueries such as:


UPDATE account
SET propCashPct = (SELECT account_position.expQty / 
(SELECT SUM(account_position.qty * security.price) 
FROM account_position, security WHERE account_position.acctId = account.id AND account_position.secId = security.id) 
FROM account_position 
WHERE account_position = account.id AND acount_position.secId = (SELECT id FROM security WHERE ticker = 'USD'))
...

(not actual statement, but constructed as an example of the form of the statement.)

Is it even possible to translate such a statement and have it still be a single SQL statement?

I am running 'LLBLGen Pro version: 1.0.2004.1'

Thanks in advance.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 13-Oct-2005 11:03:42   

What you want is currently not supported. You want to store a value X in a field, and retrieve that value X using a subquery, that's currently not possible.

Frans Bouma | Lead developer LLBLGen Pro
msimpson
User
Posts: 2
Joined: 12-Oct-2005
# Posted on: 13-Oct-2005 14:18:21   

Too bad! Thanks for the response.