Subject | Re: [firebird-support] Re: select count in view Firebird 2.5 |
---|---|
Author | Michael Ludwig |
Post date | 2010-12-14T19:36:50Z |
raivis83 schrieb am 14.12.2010 um 09:42 (-0000):
CREATE VIEW V_emp_milu( dept_no, emp_count )
AS SELECT dept_no, COUNT(*)
FROM T_employee
GROUP BY dept_no;
But maybe that doesn't apply to your real code, only to this sample.
--
Michael Ludwig
> > At 10:20 PM 14/12/2010, raivis83 wrote:Okay, so Thomas said it's a bug and fixed for 2.5.1, that's great.
> > >
> > > I have table and view, thats returning grouped field with the
> > > count of fields records in it.
> > > After upgrading from 2.1 to 2.5 I noticed that select count is
> > > returning null. Has anyone experienced anything like this and can
> > > confirm that it' s a bug and has reported it?
> > >-- ViewIn the meantime, why don't you simply redefine your view:
> > >SET SQL DIALECT 3;
> > >CREATE VIEW V_EMP_DEP(
> > > DEPT_NO,
> > > EMP_COUNT)
> > >AS
> > >select
> > > e.dept_no,
> > > (select count(*) from t_employee e1 where e1.dept_no = e.dept_no)
> Here is FB2.1 language reference for creating view:
> As you can see, column_def can have aliases.
CREATE VIEW V_emp_milu( dept_no, emp_count )
AS SELECT dept_no, COUNT(*)
FROM T_employee
GROUP BY dept_no;
But maybe that doesn't apply to your real code, only to this sample.
--
Michael Ludwig