Subject | Re: select count in view Firebird 2.5 |
---|---|
Author | raivis83 |
Post date | 2010-12-15T06:01:50Z |
--- In firebird-support@yahoogroups.com, Michael Ludwig <milu71@...> wrote:
>Exactly. Real code is much more complicated. This was just a sample code to reproduce the bug. But thanks for suggestion anyway.
> raivis83 schrieb am 14.12.2010 um 09:42 (-0000):
> > > At 10:20 PM 14/12/2010, raivis83 wrote:
> > > >
> > > > 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?
>
> Okay, so Thomas said it's a bug and fixed for 2.5.1, that's great.
>
> > > >-- 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.
>
> In the meantime, why don't you simply redefine your view:
>
> 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
>