Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL QUERY - HELLLLLLLLP!

Status
Not open for further replies.

apexinternet

Programmer
May 28, 2001
30
US
if I have a list say


George W. Bush
Earl Jenkins
Jennifer Anniston
John William Johnson Jr.
Chris Norris

how do I just pull first and last names from this?

I want it to return

firstname Lastname
George Bush
Earl Jenkins
Jennifer Anniston
John Johnson Jr. or Johnson
Chris Norris

Please help me!

Chris

God Is AWESOME!
 
Chris,

You can do this a couple of ways:

1. Add fields for the first, middle, and last name, and sequence. Then you can join the fields how you want in a query (this is how I would do it).

2. Create a function where the name list is passed to the function. Within the function, you test conditions to see how many spaces are in the string. The function then returns the name based on those conditions. The function is then referenced in your query.

hth,
GGleason
 
I didnt even get your post before I fixed it.. I used the second way...thanks.

Chris

GOD IS FAITHFUL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top