Access SQL - Remarks

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Hello

I am finding myself writing increasingly lengthy queries
in SQL view to create queries to summarize table data
e.g.CalcIfTrue: ((IIF [Field] = True,1,0))
SUM_True = Sum(CalcIfTrue)

Is there a character that I can use to have Access regard
a line as a comment? It's getting to the stage where I'm
needing to start annotating the SQL!

TIA

Kevin
 
Hello

I am finding myself writing increasingly lengthy queries
in SQL view to create queries to summarize table data
e.g.CalcIfTrue: ((IIF [Field] = True,1,0))
SUM_True = Sum(CalcIfTrue)

Is there a character that I can use to have Access regard
a line as a comment? It's getting to the stage where I'm
needing to start annotating the SQL!

You can't put comments in SQL, alas! Access/JET just doesn't support
it.

There's a shortcut which relies on the fact that True is -1 for Jet,
+1 for SQL/Server, and 0 is false:

Sum_True: Sum(Abs([Field]))

which might be simpler both to enter and document, and will certainly
make your queries run faster.
 
Back
Top