I use the DW Query mode in all of the master lists and search screens in my app... it works like a charm. But, I have a new requirement in one of my master windows to show the number of linked documents, which is stored in a different table. So my basic query changed from:
SELECT c.cal_procedure ,
c.description ,
c.active ,
c.create_user ,
c.create_date ,
c.edit_user ,
c.edit_date
FROM cal_procedure c
to:
SELECT c.cal_procedure ,
c.description ,
c.active ,
c.create_user ,
c.create_date ,
c.edit_user ,
c.edit_date ,
(SELECT COUNT(*) FROM cal_procedure_doc where cal_procedure = c.cal_procedure) AS cpd
FROM cal_procedure c
Now I get an error every time I enter a query parameter. The error is "Incorrect Syntax near the keyword 'and' ". Is there a better way to construct the SQL statement? I've tried a couple other ways with no luck.
TIA,
Tracy
c.description ,
c.active ,
c.create_user ,
c.create_date ,
c.edit_user ,
c.edit_date ,
cpd
FROM cal_procedure c
left outer join (SELECT COUNT(*) as cpd, cal_procedure FROM cal_procedure_doc GROUP BY cal_procedure) calcount ON calcount.cal_procedure = c.cal_procedure
"multi-part identifier "c.cal_procedure" could not be bound"