Solved

Access query to extract data

Posted on 2009-07-01
3
204 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oracle Pivot 2 34
Pl/SQL Query 31 61
SQL syntax error in VBA 11 32
SQL Help joining two tables 7 33
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
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.​
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 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

19 Experts available now in Live!

Get 1:1 Help Now