Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access Queries
Split / Parse last word in a field
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="JohS, post: 10729739"] Tanks to you all for feedback. And no, Sequence table of unique integers is not known for me. But I have some clue of what you are doing here, but when I pasted the code into a Query, I got error "cannot find the input table or query 'Sequence'. Any idea what I do miss out? JohS Typically, the next question is, "How do I find the second to last word?" :) If you employ the standard trick of a Sequence table of unique integers, you can use it to parse out delimited text in a column, including a space-separated text. This example uses Northwind: SELECT T1.CustomerID, S1.seq AS pos, MID(T1.CompanyName, S1.seq, MIN(S2.seq) - S1.seq - 1) AS word FROM Customers AS T1, Sequence AS S1, Sequence AS S2 WHERE MID(' ' & T1.CompanyName & ' ', S1.seq, 1) = ' ' AND MID(' ' & T1.CompanyName & ' ', S2.seq, 1) = ' ' AND S1.seq BETWEEN 1 AND 40 AND S2.seq BETWEEN 1 AND 40 AND S1.seq < S2.seq GROUP BY T1.CustomerID, T1.CompanyName, S1.seq HAVING LEN(MID(T1.CompanyName, S1.seq, MIN(S2.seq) - S1.seq - 1)) > 0 ORDER BY T1.CustomerID, S1.seq; Obviously, finding the last word is a simply matter of finding the row with MAX(pos). Jamie. -- [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access Queries
Split / Parse last word in a field
Top