在ACCESS数据库中建立如下查询,可以在ACCESS环境中正确查询数据,没有出错提示,但在DELPHI程序中作为数据直接或间接调用以下查询时,就会产生“SELECT 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确”的错误,请高手帮忙指点,谢谢!select jgmx_temp.ddid,gh1 as gh,1 as gx,'AA' as memo,d1 as dj, sl ,(dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh1>0
union all
select jgmx_temp.ddid,gh2 as gh,2 as gx, 'BB' as memo,d2 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh2>0
union all
select jgmx_temp.ddid,gh3 as gh,3 as gx,'CC' as memo,d3 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh3>0
union all
select jgmx_temp.ddid,gh4 as gh,4 as gx,'DD' as memo,d4 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh4>0
union all
select jgmx_temp.ddid,gh5 as gh,5 as gx, 'EE' as memo,d5 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh5>0
union all
select jgmx_temp.ddid,gh6 as gh,6 as gx,'FF' as memo,d6 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh6>0
union all
select jgmx_temp.ddid,gh7 as gh,7 as gx, 'GG' as memo,d7 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh7>0
union all
select jgmx_temp.ddid,gh8 as gh,8 as gx,'HH' as memo,d8 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh8>0
UNION ALL select jgmx_temp.ddid,gh9 as gh,9 as gx,'II' as memo,d9 as dj, sl, (dj*sl) as total from dj INNER JOIN jgmx_temp ON dj.ddid = jgmx_temp.ddid where gh9>0
ORDER BY jgmx_temp.ddid, gh, gx;