Subject | Re: [firebird-support] Re: How to multiply value with value from other table |
---|---|
Author | Helen Borrie |
Post date | 2005-05-09T15:31:13Z |
At 02:30 PM 9/05/2005 +0000, you wrote:
on the view.
./hb
>Helen,Yes - write a stored procedure; or create a view and do a SELECT DISTINCT
>
>Thank you very much, this works. However, can you please litle
>explain why I have to remove DISTINCT from query, since I have rows
>which I would like to remove with DISTINCT command.
>Is there any
>other solution ???
on the view.
./hb
>Regards,
>
>Zoran Zivkovic
>
>
>--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
>wrote:
> > At 11:45 AM 9/05/2005 +0000, Zoran Zivkovic wrote:
> > >Helen,
> > >
> > > I need some more help. I am receiving folowing error:
> > >
> > >Invalid token.
> > >invalid request BLR at offset 186.
> > >context already in use (BLR error).
> > >
> > >when i try to execute folowing query:
> > >
> > >SELECT DISTINCT PARTNO
> > > , EAPARTNO
> > > , FILTER_TYPE
> > > , COMMENT
> > > , CAST ((CENOVNIK.SP*(SELECT KP1.KURS from KURS_POREZ KP1)*
> > >(SELECT 1+(KP2.POREZ/100) FROM KURS_POREZ KP2) /1.00) AS DECIMAL
> > >(15,2)) AS MPC
> > >FROM FILTER_PARTS
> > >JOIN CENOVNIK ON (FILTER_PARTS.EAPARTNO=CENOVNIK.EAPARTNO)
> > >
> > >Structure of table FILTER_PARTS is
> > >
> > >CREATE TABLE FILTER_PARTS (
> > > APPL_ID INTEGER NOT NULL,
> > > PARTNO VARCHAR(10) NOT NULL,
> > > EAPARTNO VARCHAR(11) NOT NULL,
> > > FILTER_TYPE VARCHAR(16),
> > > COMMENT VARCHAR(19),
> > > DETAIL_SEQ INTEGER
> > >);
> > >
> > >Can you please advice what this could be ???
> >
> > Take out the DISTINCT and fix up your table identifiers (see my
>original
> > suggestion.)
> >
> >
> > > > SELECT
> > > > wpp.PARTNO
> > > > , wpp.EAPARTNO
> > > > , wpp.DESCRIPTION
> > > > , wpp.PART_OE AS OE /* why? */
> > > > , CAST ((c.SP * kp.KURS * kp.POREZ/1.00) AS DECIMAL
>(15,2))
> > >AS MPC
> > > >
> > > > CAST ((c.SP * (select kp1.KURS from KURS_POREZ kp1)
> > > > * (SELECT kp2.POREZ from KURS_POREZ kp2) /1.00) AS DECIMAL
> > >(15,2)) AS MPC
> > > > FROM WATER_PUMPS_PARTS wpp
> > > > LEFT JOIN CENOVNIK c
> > > > ON wpp.EAPARTNO=c.EAPARTNO
> > > >
> > > >
> > > > More elegant and speedy would be a selectable stored proc that
> > >reads the
> > > > KURS_POREZ record only once, into variables.
> > > >
> > > > ./hb
>
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit http://firebird.sourceforge.net and click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Yahoo! Groups Links
>
>
>
>