Solved

Access query to extract data

Posted on 2009-07-01
3
205 Views
Last Modified: 2012-05-07
Hi!  I need to extract from the WBS to the  next "_".  Examples below:

R_CS00185736_WBS-4.046.4_CN-AA2416
R_20_WBS-4.046.2_CN-AA400
R_67_WBS-4.047.3_CN-AA400
R_CUT_CS00163192_ECP_WBS-1.67A.1_CN-AA2158_ASIT_PAYLOADS_01283
R_CS00218685_WBS-4.046.4_CN-AA12638A
R_ZZ29275284_WBS-4.68G.12.1_CN-AA1-4
R_1_ZZ31368892_IA652Z4301-1_WBS-4.68G.13.1_CN-AA1
R_IC632Z9300-1_WBS-4.68G.10_CN-AA1-1
R_ZZ23847198_IC786Z0401-2_WBS-4.68G.11_CN-AA1
R_1_IC642Z1100-201,-203_WBS-3.68A.2_CN-AA1-28.3-1
R_622Z3060-X_ZZ30368294_WBS-4.68G.12.1_CN-AA1-1
R_1_ZZ32575861_654Z1295-6_WBS-3.68A.2_CN-AA1_45.2-1
R_ZZ31353531_WBS-4.68G.12.1_CN-AA1-3
R_654Z1295-2_ZZ32575874_WBS-3.68A.2_CN-AA1_45.2-1
R_622Z5060-1_ZZ30368292_WBS-4.68G.12.1_CN-AA1-1
R_IR780Z0402-4_ZZ31948808_WBS-3.68A.2_CN-AA1-37.1
R_788Z0417-1_-2_ZZ31948806_WBS-3.68A.2_CN-AA1-37.1
R_788Z0417-3_-4_ZZ31948814_WBS-3.68A.2_CN-AA1-37.1
R_627Z3200-2_ZZ31948903_WBS-3.68A.2_CN-AA1_40.1
0
Comment
Question by:mlaurin
  • 2
3 Comments
 
LVL 41

Expert Comment

by:ralmada
ID: 24759494
Something like this:
SELECT iif(instr(field1, "WBS-") <> 0, left(right(field1,  len(field1) - instr(field1, "WBS-") -3), instr(right(field1,  len(field1) - instr(field1, "WBS-") -3), "_")-1), "") as newcolumn

FROM Table1;

Open in new window

0
 
LVL 41

Accepted Solution

by:
ralmada earned 500 total points
ID: 24759509
And if you want to include WBS as well, try this:
SELECT iif(instr(field1, "WBS-") <> 0, left(right(field1,  len(field1) - instr(field1, "WBS-") +1), instr(right(field1,  len(field1) - instr(field1, "WBS-")), "_")), "") as newcolumn

FROM Table1;

Open in new window

0
 

Author Closing Comment

by:mlaurin
ID: 31599016
Wow!  Perfect, thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

919 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now