SQL syntax
Steve Albin
steve at steve-albin.com
Tue Sep 1 16:47:20 CDT 2009
A long time ago, I think in an early version of V4RB 3, there
was a bug in SQL where any field used in the ORDER BY and WHERE
clauses had to be contained in the SELECT clause. For instance
the following query would fail unless tableA.fld3 and
tableB.fld3 where in the SELECT list:
SELECT tableA.fld1, tableB.fld1, FROM tableA, tableB WHERE
tableA.fld3 = tableB.fld3
This has since been fixed a while back but I have lots of
queries in my app that included unused fields in the SELECT
clause to work around this bug and they are still there. Of
course, these bloated SQL queries still work, but I would like
to remove these fields from the query It occurs to me that
maybe this is bad practice. In other words, could there be any
other "gotchas" - not bugs, but bad SQL programming practices -
that I should consider before trimming down the SELECT clauses
to not include fields in the WHERE and ORDER BY clause?
Thanks for any advice,
Steve
--
Steve Albin - Montclair, NJ
http://www.jazzdiscography.com/
http://www.steve-albin.com/
More information about the Valentina
mailing list