SQL Apprentice Question
Is it possible to use a columnvalue in a subquery? Like this:
SELECT id, tablename, columnname, description,
(SELECT Count(columnname) FROM tablename) as recordcount
FROM tableobjects
Obviously where "columnname" and "tablename" in the subquery should be the
values from columns in "tableobjects".
Celko Answers
>> Is it possible to use a columnvalue in a subquery? Like this: <<
Perhaps you ought to look up ther concepts of coupling an cohesion in a
basic text on software engineering, so you will know better than to
write code like this. This kidn of code is unpredictable until run
time, has no cohesion, etc. This is not just bad SQL; it is bad
programming in any language.
Monday, May 29, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment