What is this SQL telling me

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to get familiar with a database I didn't design, and there is
this line in this query:
SELECT AsbestosBridge.COUNTY, AsbestosBridge.BIN, RC12.Description AS
Carried, RC13.Description AS Crossed,...

What is "RC12.Description AS Carried" going to return? In the table for
RC12 there is a description, but no Carried. Same with Crossed. In the
AsbestosBridge table there is Carried and Crossed but no description.

The whole query (below) works and returns the descriptions, but Why is it
set up like this?

Any help is greatly appreciated.
Ken




SELECT AsbestosBridge.COUNTY, AsbestosBridge.BIN, RC12.Description AS
Carried, RC13.Description AS Crossed, AsbestosBridge.YEAR_BUILT,
AsbestosBridge.Painted, AsbestosBridge.PaintSamplingPriority,
AsbestosBridge.SampledPaint, AsbestosBridge.OnBridge, AsbestosBridge.InPaint,
AsbestosBridge.SampleRequested, AsbestosBridge.S1Date
FROM (AsbestosBridge INNER JOIN RC12 ON AsbestosBridge.BIN = RC12.BIN) INNER
JOIN RC13 ON AsbestosBridge.BIN = RC13.BIN
WHERE (((AsbestosBridge.Painted)=Yes) AND ((RC13.[Feature Number])=2))
ORDER BY AsbestosBridge.COUNTY, AsbestosBridge.BIN;
 
These two are simply alias or a rename of the column. This have some level
of importance in this case because two tables, RC12 and RC13, have two
columns with the same name. If you don't use alias, you will have to refer
to these two columns on the client side as RC12.Description or
[RC12.Description] or "RC12.Description" instead of just Description.

S. L.
 
"AS Carried" is how you assign an alias for the RC12.Description field -- in
other words, the query displays Carried as the name of the field in its
output records. Often it's done for use in label captions for controls that
are bound to the field, or for clarity to the "reader" of the query's
output, or for the heading that goes into an EXCEL or text file if you
export the query.
 
Back
Top