What does & ", " & means ?

S

SpookiePower

I found this query in the Northwind sample database.

SELECT Employees.EmployeeID, [LastName] & ", " & [FirstName] AS ReportsTo
FROM Employees
ORDER BY Employees.LastName, Employees.FirstName;

I do not know, in the first line, what & ", " & means ??

Someone who can help me with this one ?
 
J

Jason Lepack

[LastName] & ", " & [FirstName]

this takes two fields [LastName] and [FirstName] and combines them
into one field with a comma seperating them.

So:
[FirstName] = "Jason"
[LastName] = "Lepack"
[LastName] & ", " & [FirstName] = "Lepack, Jason"

Cheers,
Jason Lepack
 
J

John W. Vinson

I do not know, in the first line, what & ", " & means ??

Any string surrounded by quotemarks is just a literal text string - in this
case, a comma followed by a blank. If you had "Spookie" it would be the
literal text string Spookie.

The & operator concatenates two strings, just like the + operator adds two
numbers.

So if FirstName is John, and LastName is Vinson, the expression would
concatenate three pieces of text - the last name, a literal text string, and
the firstname - to give

Vinson, John

as the result.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top