MySQL Forums
Forum List  »  Microsoft Access

Splitting a field divided by characters \ and , into 3 fields
Posted by: Brent Surphlis
Date: September 22, 2010 01:54PM

Hello, I am trying to split a column into 3 parts. here is what I have so far

SELECT Left(MODEL,InStr(1,MODEL,",")-1) AS BRAND,
Mid(MODEL,InStr(1,MODEL,"\")+1) AS LOCATION,
MID(MODEL,InStr(1,MODEL,",")+1) AS COUNTRY
FROM PRINTERS;

Which gives this result:

BRAND LOCATION COUNTRY
_LAN Other ON 0304 Blenheim Canada - PWC Retail Branch\ON 0304 Blenheim
_LAN HP SK 0697 Wynyard Canada - PWC Retail Branch\SK 0697 Wynyard

I need to drop anything after the "\" in the COUNTRY field.

How do I do this all in 1 query?

Thanks!!!!

Options: ReplyQuote


Subject
Views
Written By
Posted
Splitting a field divided by characters \ and , into 3 fields
2537
September 22, 2010 01:54PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.