Hi,
I am new to HSQL DB and am trying to translate few sybase query to HSQL to get a grasp of HSQL. I have a the following query, how will I translate it in HSQL DB.
UPDATE Table1
SET NewBalance = convert(NUMERIC(16, 2), A.Balance* B.charge)
FROM tempdb..Table1 A, Table2 B
WHERE A.UserID = @Userid
AND A.Store = B.Store
AND B.Date = @Date
AND B.Category = @Category
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
UPDATE Table1 A
SET A.NewBalance = (SELECT convert( A.Balance B.charge, DECIMAL(16, 2))
FROM Table2 B
WHERE A.Store = B.Store
AND B.Date = Date
AND B.Category = Category )
WHERE A.UserID = userid;*
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am new to HSQL DB and am trying to translate few sybase query to HSQL to get a grasp of HSQL. I have a the following query, how will I translate it in HSQL DB.
UPDATE Table1
SET NewBalance = convert(NUMERIC(16, 2), A.Balance* B.charge)
FROM tempdb..Table1 A, Table2 B
WHERE A.UserID = @Userid
AND A.Store = B.Store
AND B.Date = @Date
AND B.Category = @Category
translated the query as pasted below.
UPDATE Table1 A
SET A.NewBalance = (SELECT convert( A.Balance B.charge, DECIMAL(16, 2))
FROM Table2 B
WHERE A.Store = B.Store
AND B.Date = Date
AND B.Category = Category )
WHERE A.UserID = userid;*
You cannot have a FROM clause in an update statement itself. A subselect is used as you have translated.
Last edit: Fred Toussi 2014-03-11
thanks fred for confirming