Board index » delphi » Semi-funky SQL is finicky about when/where it works

Semi-funky SQL is finicky about when/where it works


2006-10-19 10:34:43 AM
delphi131
Using Delphi 6, Firebird 1.5, UIB data access components (home project)
The following does just what I want it to do in Database Workbench's SQL
Editor:
SELECT TALK_DESIGNATOR, TALK_TITLE,
(select count(id) from speaker_outlines where outline_id =
OUTLINES.TALK_DESIGNATOR)
FROM OUTLINES
ORDER BY TALK_DESIGNATOR
--but using it in Delphi (trying to add all of the fields to a dataset at
design-time with the fields editor), I get "Field Name Missing" re: the
subselect field.
I assume I must put an "AS <FieldName>" somewhere in the subselect, but I've
tried various spots, with and without quotes around the field name, and
nothing works.
Any ideas anyone?
--
Download my historical nonfiction and/or satirical (etc.) fiction books free
from here:
www.lulu.com/blackbirdcraven
 
 

Re:Semi-funky SQL is finicky about when/where it works

Quote

--but using it in Delphi (trying to add all of the fields to a dataset at
design-time with the fields editor), I get "Field Name Missing" re: the
subselect field.

I assume I must put an "AS <FieldName>" somewhere in the subselect, but
I've tried various spots, with and without quotes around the field name,
and nothing works.
In SQL Server it would be (not firebird sorry, don't use Interbase
anymore):
SELECT TALK_DESIGNATOR, TALK_TITLE,
(select count(id) from speaker_outlines where outline_id =
OUTLINES.TALK_DESIGNATOR) as countfield
FROM OUTLINES
ORDER BY TALK_DESIGNATOR
Oliver Townshend
 

Re:Semi-funky SQL is finicky about when/where it works

"Oliver Townshend" <oliveratzipdotcomdotau>writes
Quote

SELECT TALK_DESIGNATOR, TALK_TITLE,
(select count(id) from speaker_outlines where outline_id =
OUTLINES.TALK_DESIGNATOR) as countfield
FROM OUTLINES
ORDER BY TALK_DESIGNATOR
Thanks--I could've sworn I would tried that, but I guess I hadn't (works in
Firebird, too)
--
Download my historical nonfiction and/or satirical (etc.) fiction books free
from here:
www.lulu.com/blackbirdcraven