Here's an idea -- patience is a virtue. Some of us read the list when we get a chance, and can't just jump on every e-mail because we actually do work at work.
mysql> create table Orders (partno int unsigned not null, quant tinyint unsigned not null); Query OK, 0 rows affected (0.07 sec) mysql> insert into Orders VALUES(1254,5),(1414,5),(14758,1),(1254,6),(1024,3),(1254,1); Query OK, 6 rows affected (0.00 sec) Records: 6 Duplicates: 0 Warnings: 0 mysql> select partno,SUM(quant) from Orders where partno=1254 group by partno; +--------+------------+ | partno | SUM(quant) | +--------+------------+ | 1254 | 12 | +--------+------------+ 1 row in set (0.00 sec) mysql> select repeat(concat(partno,' '),SUM(quant)) from Orders where partno=1254 group by partno; +--------------------------------------------------------------+ | repeat(concat(partno,' '),SUM(quant)) | +--------------------------------------------------------------+ | 1254 1254 1254 1254 1254 1254 1254 1254 1254 1254 1254 1254 | +--------------------------------------------------------------+ 1 row in set (0.00 sec) So something like that. I don't know that you can create more than one record, though. -Sheeri On 4/7/06, Ed Reed <[EMAIL PROTECTED]> wrote: > Anyone have an idea on this? > > Can anyone explain how I might be able to return a numbers of records based > on the sum of a quantity in a field in the same table? (After I read that it > sounds even confusing to me). > > Let me explain. I have records like this, > > Part# Qty > 1254 5 > 1414 2 > 14758 1 > 1254 6 > 1024 3 > 1254 1 > > > Now if I did a query like this > Select Part#, Sum(Qty) From table1 Group By Part# Where Part#=1254 > > I would expect my results to look like this > Part# Sum(Qty) > 1254 12 > > But what I really want is this > Part# > 1254 > 1254 > 1254 > 1254 > 1254 > 12541254 > 1254 > 12541254 > 1254 > 1254 > > So 12 virtual records for the count of the records returned from the Sum() > > Can someone help me with this? > > - Thanks > > > > > > > -- > 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]