Maciej Gąssowski
Maciej Gąssowski

Reputation: 43

how conversion select into query

I need to convert this Select from sql server to Access

select ep.SWProduct_ID, ep.NormalizedName, e.Product, e.CreatedDate, MAX(m3.MappedDate)
from V_EOLProducts_ToMap ep 
inner join V_eol e on ep.Product = e.Product
inner join T_ProductEOL_Mapping m3 on m3.SwProduct_ID=e.SwProduct_ID 
where e.CreatedDate >'2018-07-05' 
and not exists (select * from T_ProductEOL_Mapping m where m.eol_id=e.eol_id)
and exists (select * from T_ProductEOL_Mapping m2 where m2.SwProduct_ID=e.SwProduct_ID)
AND e.CreatedDate > m3.MappedDate
group by ep.SWProduct_ID, ep.NormalizedName, e.Product, e.CreatedDate
order by SwProduct_ID 

I have tried the query below and i also need to change the value #01/07/2018# into a variable

select ep.SWProduct_ID, ep.NormalizedName, e.Product, e.CreatedDate, MAX(m3.MappedDate)

from (dbo_V_EOLProducts_ToMap ep 
inner join dbo_V_eol e on ep.Product = e.Product)
inner join dbo_T_ProductEOL_Mapping m3 on m3.SwProduct_ID=e.SwProduct_ID 

where e.CreatedDate >#01/07/2018#
and not exists (select * from dbo_T_ProductEOL_Mapping m where m.eol_id=e.eol_id)
and exists (select * from dbo_T_ProductEOL_Mapping m2 where m2.SwProduct_ID=e.SwProduct_ID)
AND e.CreatedDate > m3.MappedDate

group by ep.SWProduct_ID, ep.NormalizedName, e.Product, e.CreatedDate

order by ep.SwProduct_ID  

EDIT
From the comments it seems he is getting this error

enter image description here

Upvotes: 2

Views: 41

Answers (1)

GuidoG
GuidoG

Reputation: 12014

access has a very weird join style, you need lots of brackets.
if I remember correct this should get your join valid for access

from ((dbo_V_EOLProducts_ToMap ep 
  inner join dbo_V_eol e on ep.Product = e.Product)
  inner join dbo_T_ProductEOL_Mapping m3 on m3.SwProduct_ID = e.SwProduct_ID)

Upvotes: 2

Related Questions