re-send :
Hi,
you can use mysql variables :
set @total:=0;
select name,price,quantity, price*quantity as
subtotal,@total:[EMAIL PROTECTED]
from fruits;
++---+--+--+---+
| name | price | quantity | subtotal | @total:[EMAIL PROTECTED
On May 30, 2005, at 1:28 AM, [EMAIL PROTECTED] wrote:
you can just play :
set @total:=0;
select name,price,quantity, price*quantity as
subtotal,@total:[EMAIL PROTECTED]
from fruits;
select @total as "grand total";
works great. thanks very, very much.
- philip
--
MySQL General
Hi Philip,
what yoy called gand total is in @total for evevy row.
you can just play :
> > set @total:=0;
> > select name,price,quantity, price*quantity as
> > subtotal,@total:[EMAIL PROTECTED]
> > from fruits;
select @total as "grand total";
that's all !
Mathias
Selon Philip George <[
Hi,
you can use mysql variables :
set @total:=0;
select name,price,quantity, price*quantity as
subtotal,@total:[EMAIL PROTECTED]
from fruits;
++---+--+--+---+
| name | price | quantity | subtotal | @total:[EMAIL PROTECTED] |
++
On May 29, 2005, at 2:34 PM, [EMAIL PROTECTED] wrote:
you can use mysql variables :
set @total:=0;
select name,price,quantity, price*quantity as
subtotal,@total:[EMAIL PROTECTED]
from fruits;
++---+--+--
+---+
| name |
re-submitted :
re-send :
Hi,
you can use mysql variables :
set @total:=0;
select name,price,quantity, price*quantity as
subtotal,@total:[EMAIL PROTECTED]
from fruits;
++---+--+--+---+
| name | price | quantity | subtotal
actually, i've decided this is sort of a moot point, since i can do
this calculation in the client app.
no sql required.
thanks.
- philip
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
On 5/29/05, Philip George wrote:
> On 5/29/05, Philip George wrote:
>> On 5/29/05, Jochem van Dieten wrote:
>>> http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html
>>
>> already read that. the join in my example is more complicated than
>> anything depicted on that page.
>>
>> please explai
The join is irrelevant. Your join returns a resultset and you can just
pretent that resultset is a single table:
SELECT field1, field2, field3
FROM (very complicated join) AS simpletable
GROUP BY ...
WITH ROLLUP
Just copy-pate your join into this and fix the fieldnames.
aaahhh
okay, i'm
http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html
already read that. the join in my example is more complicated than
anything depicted on that page.
please explain.
actually i should say that there are no examples of SUM() or AVG() --
or any of the other GROUP BY functions -- th
On 5/29/05, Philip George wrote:
> On May 29, 2005, at 1:41 AM, Jochem van Dieten wrote:
>>
>> http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html
>
> already read that. the join in my example is more complicated than
> anything depicted on that page.
The join is irrelevant. Your join retu
On May 29, 2005, at 1:41 AM, Jochem van Dieten wrote:
http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html
already read that. the join in my example is more complicated than
anything depicted on that page.
please explain.
- philip
--
MySQL General Mailing List
For list archives:
On 5/29/05, Philip George <[EMAIL PROTECTED]> wrote:
>
> +--++---+--+
> | quantity | name | price | subtotal |
> +--++---+--+
> |1 | orange | 0.97 | 0.97 |
> |3 | pear | 1.09 | 3.27 |
> +--++-
guess i'll just ask:
here are the 2 tables of interest:
mysql> select * from ticket_details;
+--
+--+--+
| ticket | product
| quantity |
+
if you want a way to quickly experiment with sql
joins, try corereader. it's a free download from
http://www.corereader.com/
after you make a data connection, you press the load
button to load the metadata. after that, everything
is point and click to select from drop-down lists.
that ma
ptember 24, 2002 12:46 PM
Subject: RE: Basic SQL join question
> > SELECT *
> > FROM Projects
> > INNER JOIN KeywordLink ON Projects.Id = KeywordLink.Pid
> > INNER JOIN Keywords KeywordLink.Kid = Keywords.Id
> > WHERE Keyword LIKE '%historical%' AND
>
> SELECT *
> FROM Projects
> INNER JOIN KeywordLink ON Projects.Id = KeywordLink.Pid
> INNER JOIN Keywords KeywordLink.Kid = Keywords.Id
> WHERE Keyword LIKE '%historical%' AND
> Keyword like '%scenic%';
Out of curiousity, does the order matter?
I have a JOIN with about 6 tables, some are very s
SELECT *
FROM Projects
INNER JOIN KeywordLink ON Projects.Id = KeywordLink.Pid
INNER JOIN Keywords KeywordLink.Kid = Keywords.Id
WHERE Keyword LIKE '%historical%' AND
Keyword like '%scenic%';
1. Note the single quotes.
2. You can place the join logic in the WHERE clause but I prefer the clarity
o
18 matches
Mail list logo