QUERY FROM SQL SERVER TO ACCESS

ACCESS 2010

i HAVE THIS CODE FROM SQL SERVER 2008

Can this be used and translated to access sql  ??



ELECT distinct case when wwgsku = '44055' then 'WSKU'
      when WWGMfrNumCondensed = '44055' then 'WMFR'
      when [CompSKUCondensed] = '44055' then 'CSKU'
      when [CompMfrNumCondensed] = '44055' then 'CMFR' else 'NA' end as Match_Type
      , a.*
    
       
  FROM [XRef_Master_TD].[dbo].[main_xref_t1_1] as a
  where [CompMfrNumCondensed] = '44055'
  or [CompSKUCondensed] = '44055'
  or wwgsku = '44055'
  or WWGMfrNumCondensed = '44055'

Open in new window




Thanks
fordraiders
LVL 3
FordraidersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
Yes, you will need to change a bit:

SELECT distinct Iif(wwgsku = '44055', 'WSKU', 
      Iif(WWGMfrNumCondensed = '44055', 'WMFR',
      Iif([CompSKUCondensed] = '44055', 'CSKU',
      Iif([CompMfrNumCondensed] = '44055', 'CMFR', 'NA')))) as Match_Type
      , a.*
FROM main_xref_t1_1 as a
  where [CompMfrNumCondensed] = '44055'
  or [CompSKUCondensed] = '44055'
  or wwgsku = '44055'
  or WWGMfrNumCondensed = '44055'

Open in new window


On a side note, I advise you against using * in the select queries. I recommend you list all the columns. This way it is guaranteed that you are receiving the columns in the right order, and the applications that read the results are not broken when you add new columns, or re-arrange the order of the columns in the table
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FordraidersAuthor Commented:
so if i had 6 fields  a.wwgsku, a.WWGMfrNumCondensed, CompSKUCondensed,CompMfrNumCondensed, item, Namert

any brackets or parentheses ?
0
chaauCommented:
You can include the column names in square brackets, if you wish. That way it is guaranteed that the name will not be rejected if it happen to be the same as one of the reserved Access keywords
0
FordraidersAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.