Hi!
As I wrote before this works fine and I DO get a nice result;

SELECT SUM(trans2.nettovikt) as summa FROM trans2 INNER JOIN artikel on
trans2.artikel=artikel.artikel WHERE trans2.transtid between '2007-07-01
00:00:00' and '2007-07-02 23:59:59' and artikel.reservinteger='01' group by
artikel.volympris;

For a brief moment, it seemed to work but now I only get this "no
data..."-answer.

All tables exist in the selected DB and the are full with lovely data
I use the same user as in the query browser.

Thanks!
/Tomas

On Dec 13, 2007 3:29 AM, Martin Gainty <[EMAIL PROTECTED]> wrote:

> Hi Tomas
>
>  I'll need more info so I could follow up
> Do all the Tables exist in the currently selected DB?
> Do all the tables have data?
> Does the current user you are using to run the Procedure have the DML
> permission to create/query/insert/update or execute?
>
> M--
> ----- Original Message -----
> From: "Tomas Hylander" <[EMAIL PROTECTED]>
> To: "Martin Gainty" <[EMAIL PROTECTED]>
> Cc: <mysql@lists.mysql.com>
> Sent: Monday, November 26, 2007 1:38 AM
> Subject: Re: Problem with a Procedure
>
>
> > Hi!
> > I must say I cant see how this would help me. I know the tabels isnt
> > empty since when running in query browsern I get a result.
> > There must be something else thats wrong..
> >
> > ...but thanks anyway!
> > /Hylsan
> >
> > On Nov 23, 2007 4:43 PM, Martin Gainty <[EMAIL PROTECTED]> wrote:
> > >
> > >  Tomas-
> > >
> > > I would effect a quick iterative check on the table(s) to see if they
> are
> > > empty e.g.
> > >
> > >  SELECT count(trans2.nettovikt) from trans2;
> > >
> > > (If recordcount>0) then
> > >  SELECT SUM(trans2.nettovikt)
> > >
> > >  FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> > >
> > > (If recordcount>0) then
> > >
> > >  SELECT SUM(trans2.nettovikt) INTO ut_summa
> > >  FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> > >  WHERE trans2.transtid between 'datum1' and 'datum2'
> > >
> > >  (If recordcount > 0) then
> > >
> > >   SELECT SUM(trans2.nettovikt) INTO ut_summa
> > >   FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> > >   WHERE trans2.transtid between 'datum1' and 'datum2'
> > >    and artikel.reservinteger='skatt'
> > >
> > >  (If recordcount > 0) then
> > >
> > >   SELECT SUM(trans2.nettovikt) INTO ut_summa
> > >   FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> > >   WHERE trans2.transtid between 'datum1' and 'datum2'
> > >    and artikel.reservinteger='skatt'
> > >   group by artikel.volympris;
> > >
> > > Does this help???
> > >
> > > Martin Gainty
> > >
> > > ______________________________________________
> > > Disclaimer and confidentiality note
> > > Everything in this e-mail and any attachments relates to the official
> > > business of Sender. This transmission is of a confidential nature and
> Sender
> > > does not endorse distribution to any party other than intended
> recipient.
> > > Sender does not necessarily endorse content contained within this
> > > transmission.
> > >
> > >
> > > > Date: Fri, 23 Nov 2007 11:10:47 +0100
> > > > From: [EMAIL PROTECTED]
> > > > To: mysql@lists.mysql.com
> > > > Subject: Problem with a Procedure
> > >
> > >
> > > >
> > > > Hi!
> > > > Hope you can help me with this one.
> > > > Im trying to learn this with stored procedures and optimize my
> databases.
> > > > Can someone point what wrong with this?
> > > >
> >
> >
> --------------------------------------------------------------------------
> ------------------------------------------------------------
> > > >
> > > > DELIMITER $$
> > > >
> > > > DROP PROCEDURE IF EXISTS `vagsql`.`sok` $$
> > > > CREATE [EMAIL PROTECTED] PROCEDURE `sok`(skatt int,
> > > > datum1 DATE,
> > > > datum2 DATE,
> > > > OUT ut_summa decimal(8,2))
> > > > BEGIN
> > > >
> > > > SELECT SUM(trans2.nettovikt) INTO ut_summa
> > > > FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> > > > WHERE trans2.transtid between 'datum1' and 'datum2'
> > > > and artikel.reservinteger='skatt'
> > > > group by artikel.volympris;
> > > >
> > > > END $$
> > > >
> > > > DELIMITER ;
> > > >
> > > >
> >
> >
> --------------------------------------------------------------------------
> ----------------------------------------------
> > > >
> > > > call sok('01','2007-01-01 00:00:00', '2007-01-10 23:59:59', @out);
> > > > select @out;
> > > >
> > > > All I get is that "No data - zero rows fetched, selected or
> processed"
> > > >
> > > > When running this in query brower everything looks ok.
> > > > SELECT SUM(trans2.nettovikt) as summa FROM trans2 INNER JOIN artikel
> on
> > > > trans2.artikel=artikel.artikel WHERE trans2.transtid between
> '2007-07-01
> > > > 00:00:00' and '2007-07-02 23:59:59' and artikel.reservinteger='01'
> group
> > > by
> > > > artikel.volympris;
> > > >
> > > > Im running mysql 5.1.11.
> > > >
> > > > Thanks in advance!
> > > > /Tomas
> > >
> > >
> > > ________________________________
> > > Share life as it happens with the new Windows Live. Share now!
> >
>
>

Reply via email to