Solved

Query

Posted on 2011-09-22
8
215 Views
Last Modified: 2012-06-22
Hi,

I have quer in sql and I want to convert it in MS access

update  YourTable
  Set   ColumnResult  =case when SUBSTRING(RIGHT(column1,7),1,2)='ws' then 'JK'
              when SUBSTRING(RIGHT(column1,7),1,2)='sa' then 'KR'
         end        
0
Comment
Question by:samprg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 40

Expert Comment

by:als315
ID: 36585035
IIF(mid(Right(column1,7),1,2)="ws", "JK", IIF(mid(Right(column1,7),1,2)="sa","KR",""))
0
 
LVL 40

Expert Comment

by:als315
ID: 36585054
Of full query (for Table1):
UPDATE Table1 SET Table1.ColumnResult = IIf(Mid(Right([column1],7),1,2)="ws","JK",IIf(Mid(Right([column1],7),1,2)="sa","KR",""));
0
 
LVL 40

Accepted Solution

by:
als315 earned 250 total points
ID: 36585056
For YourTable:
UPDATE YourTable SET YourTable.ColumnResult = IIf(Mid(Right([column1],7),1,2)="ws","JK",IIf(Mid(Right([column1],7),1,2)="sa","KR",""));
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 12

Expert Comment

by:pdebaets
ID: 36585065
update  YourTable Set   ColumnResult  = iif(Instr(1,RIGHT(column1,7),2)='ws,'JK',iif(Instr(1,RIGHT(column1,7),2)='sa','KR',""))
Where Instr(1,RIGHT(column1,7),2)='ws OR Instr(1,RIGHT(column1,7),2)='sa';
0
 

Author Comment

by:samprg
ID: 36585075
How can I use
IIF(mid(Right(column1,7),1,2)="ws", "JK", IIF(mid(Right(column1,7),1,2)="sa","KR",""))
in  update statement
0
 

Author Comment

by:samprg
ID: 36585085
I am sorry, I did not see your answers I should refresh IE.
I will try it
0
 
LVL 12

Assisted Solution

by:pdebaets
pdebaets earned 250 total points
ID: 36585094
My use of "Instr" is incorrect above. Please use

update  YourTable Set   ColumnResult  = iif(Mid(RIGHT(column1,7),1,2)='ws,'JK',iif(Mid(RIGHT(column1,7),1,2)='sa','KR',""))
Where Mid(RIGHT(column1,7),1,2)='ws OR Mid(RIGHT(column1,7),1,2)='sa';
0
 

Author Closing Comment

by:samprg
ID: 36590601
Awesome
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question