May 2, 2012 at 8:08 PM
Edited May 2, 2012 at 8:40 PM

I can't find any documentation on how to use aliases for column names or table names, can somebody point me in the right direction?  I know I can use .As("tablealias") but I when I'm specifying Fields do I do it like this?:

May 2, 2012 at 11:29 PM

My example works, I just answered my own question.  Now I need to figure out how to concatenate to fields into one, e.g. 

.Field(DB.User.FirstName + " " + DB.User.LastName).As("SalesRep")

But with code that works.

May 3, 2012 at 12:06 PM

This should work for SQL server

 DBQuery concat = DBQuery.Select(DBField.Field("FirstName") + DBConst.Const(" ") + DBField.Field("LastName")).As("FullName")

Breaks database agnostic(ity?) as other DB engines don't support this overload.
There is also a DBFunction.Function method that will accept multiple clause parameters if you need to use this 

May 3, 2012 at 5:40 PM
Edited May 3, 2012 at 5:40 PM

The resultant SQL contains this, which obviously results in an error.  I'm not sure what to do. 

SELECT [FirstNamePerceiveit.Data.Query.DBConstRefLastName] AS [SalesRep]

May 4, 2012 at 9:49 AM

Influent - Use a DBField rather than a string as this is just concatenating strings in your executing code.

DBField.Field(DB.User.FirstName) + DBConst.String(" ") + DBField.Field(DB.User.LastName)

This will then be built into a concatenation on the SQL string.