select * from (
select a.code,a.gid from productonsale a,
productinformation b,
GeneralStandardCategory c
where a.prodid=b.gid
and b.StdCatID =c.gid
and c.code in ('607','609')
and a.ChlID='0DB3B832-3E16-E111-A1F0-4437E63336BD'
union all
select a.code,a.gid from productonsale a,
productinformation b,
GeneralStandardCategory c,
ProductAttribute d,
(select gid,matter from GeneralResource where matter like '%1860%') e
where a.prodid=b.gid
and b.StdCatID =c.gid
and a.prodid=d.prodid
and d.content=e.gid
and c.code in ('603','602')
and a.ChlID='0DB3B832-3E16-E111-A1F0-4437E63336BD'
) date where Gid='5577b910-103a-e311-a37d-00e081d461dd'