[AccessD] Undocumented Access SQL syntax - Derived tables

Michael Maddison michael at ddisolutions.com.au
Thu Jul 29 23:15:21 CDT 2004


Hi list,

I've been mainly working in SQL 2K for a while now and have grown to
love using derived tables in my sql statements.  A shame you can't do
the same in Access! You thought so, well so did I.  A colleague came
across a website (no link,sorry) which shows how to do derived tables in
MS Access.

Undocumented Syntax
SELECT .* 
FROM
[SELECT sum(x) FROM FOO]. BAR

***Notice the [] and the space after the .

This works like a charm, even the query designer likes it!  The only
drawback I've found (apart from being undocumented)
is the derived tables cannot have column names with square brackets
arround them.
So 
	SELECT .* 
	FROM
	[SELECT sum([My Badly Named Field]) FROM FOO]. BAR
Will not parse correctly.

Try it out.

cheers

Michael M



More information about the AccessD mailing list