SQL isn't a spreadsheet program.  It's a database programming language.  As
such, it's not going to output tables in the manner you want.

>From what I see, it looks like you want to get individual results and a total
for each year.  As best I can figure (without sub-selects), that will take two
queries, one to get the per-year info, another to get the total of that info.

SELECT * FROM table WHERE year=YYYY;
SELECT sum(budget) FROM table;

You then need some sort of scripting language to put this into the format you
desire.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Glenn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, 12 June, 2003 06:25
Subject: tables


Hi,
I have this:
+----+-------+--------+
¦ Jahr ¦ Name  ¦ Budget  ¦
+----+-------+--------+
2003  Hans      2000
2003  Fritz       5000
2004  Hans      1500
2005  Pia         3500

How is it possible to make this in sql?

+---------------------+
¦ 2003   Hans    2000  ¦
¦ 2003   Fritz     5000  ¦
+---------------------+
¦ Total               7000  ¦
+---------------------+

+---------------------+
¦ 2004   Hans    1500  ¦
+---------------------+
¦ Total               1500  ¦
+---------------------+

+---------------------+
¦ 2005    Pia      3500  ¦
+---------------------+
¦ Total               3500  ¦
+---------------------+

Thanks a lot,
Glenn




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





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

Reply via email to