English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a Microsoft Access table with three fields: First, Last and Full. In all rows where Last = "Smith" I want to write the contents of First and Last (separated by a space) in Full.

It's easy, I know, but I am just starting in SQL.

Thanks

2006-09-03 13:37:49 · 3 answers · asked by leegomes 1 in Computers & Internet Software

3 answers

This is straight SQL with no allowances for any 'special' Microsoft Access features. It should work in any ANSI standard SQL based DB:

UPDATE MyTable
SET FullName = LastName||', '||FirstName
WHERE Lastname = 'Smith'

the vertical lines '||' mean concatinate the field in back to the field in front. The ', ' places a text literal of a comma and a space between the last and first name. so I am telling the DB to smoosh the LastName, a comma and a space, AND the FirstName together.

The UPDATE tells the DB which table to use and the SET tells the DB which field to update (FullName) with which fields (LastName||', '||FirstName).

Of course, the WHERE clause specifies which conditions must be true for the update to occur to a given record in the table.

2006-09-03 16:24:39 · answer #1 · answered by glenbarrington 7 · 0 0

If you don't want to use SQL, create a new query.

Change the type of query to an Update query
Add the table with the three name fields entered.
Bring down the 'Full' field

In the 'Update To:' line enter:
[Last] & ", " & [First]

If you have leading or trailing spaces in the Last or First fields enter this instead:

Trim([Last]) & ", " & Trim([First])

I hope this helps

2006-09-04 08:46:00 · answer #2 · answered by Dale A 1 · 0 0

The collective subconscious is (allegedly) the existence-container from which all residing issues emerge, grass, amoebas, girraffes, you! that is there each and every of the time - like an electric powered container round your laptop notwithstanding it isn't the laptop itself. at times there'll be a "glitch" and your laptop will pluck somthing random from the container yet except you're very astute - even with the reality that you get ought to haven't any intending to you. if you're astute then you extremely ought to nicely be able to "faucet-in" and glean issues that is going previous different peoples awarenesses. From their perspective you need to nicely be a magician or perchance a trickster... or a messiah! some thing to imagine about before starting up your next incarnation. Have a clean CD ROM waiting and prepared - basically in case.

2016-12-06 08:19:42 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers