I need a query like this, which is being generated using sqlbuilder Java functions:
SELECT Sum(prod) / Sum(
total_prod)
AS PROD,
Max(year) AS YEAR
FROM b.sum SumTable
WHERE ( SumTable.bg IN
(SELECT DISTINCT
SubSumTable.s_id
FROM
b.block
SSumSubTable
WHERE ( (
SSumSubTable.id IN ( 3 ) ) ) )) )
But instead when the subquery is generated it creates it like:
SELECT Sum(prod) / Sum(
total_prod)
AS PROD,
Max(year) AS YEAR
FROM b.sum SumTable, b.block
SumTable
WHERE ( SumTable.ab IN
(SELECT DISTINCT
SumTable.c_id
FROM
b.block
SumSubTable
WHERE ( (
SumSubTable.id IN ( 3 ) ) ) )) )
It automatically appends the subquery table name i.e b.block SubSumTable because of which the query is not working. Any suggestion to overcome this would be a great help.