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!

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to