Posted: Fri Feb 21, 2014 2:12 am Post subject: Nested query in esql message broker
Centurion
Joined: 03 Nov 2006 Posts: 108
Hi Team,
We are using below query to retrieve all Employees (Character) and Amount (Decimal) that contain recent access date (Date).
Note: Both are the same table specified in where clause.
DECLARE selectSql CHARACTER 'SELECT Emp AS Employee,
Amt AS Amount
FROM DB_PREFIX.Table
WHERE Date = (SELECT MAX(B.Date)
FROM DB_PREFIX.table B
WHERE Employee = B.Employee)
WITH UR';
DELETE Field Environment.temp.*[<];
SET Environment.fromTable[]= PASSTHRU (selectSql);
Posted: Fri Feb 21, 2014 2:40 am Post subject: Re: Nested query in esql message broker
Master
Joined: 23 Jul 2009 Posts: 297
team wrote:
Is the above syntax correct?
I don't think so (your db server will be complaining about an ambiguous reference to Employee, for one thing). But since you're formatting an SQL query and using PASSTHRU, this has little to do with ESQL or WMB, and more with the underlying database server you're using.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum