--- Ed Reed <[EMAIL PROTECTED]> wrote:

> Thanks for the response Shawn but there's nothing covert here. I
> really need a list of partnumbers based on the Sum of that part in
> the table. My users will be marking off the parts in the list and if
> there a more than one of a partnumber then it needs to show up in the
> list more than once.
>  
> - Thanks again
> 
> >>> Shawn Green <[EMAIL PROTECTED]> 4/12/06 12:15:56 PM >>>
> 
> 
> --- Ed Reed < [EMAIL PROTECTED] > wrote:
> 
> > Thanks for the response but neither one of the responses I've
> > received does exactly what I need since they don't return multiple
> > rows.
> > 
> > Are there any other ideas out there?
> > 
> > Thanks
> > 
> > >>> "Jay Blanchard" < [EMAIL PROTECTED] > 4/7/06 12:37:32 PM
> >>>
> > [snip]
> > 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()
> > [/snip]
> > 
> > Please do not hijack threads, open a new e-mail and send it to the
> > list
> > address.
> > 
> > SELECT REPEAT(Part#, count(Part#)) FROM table WHERE Part# = '1254'
> > 
> 
> What you are asking MySQL to do is not a normal request. There are
> probably better ways to solve your issue than by creating "fake" or
> "virtual" data. 
> 
> As was posted before, what is the real reason you want to
> auto-generate
> separate rows of data? If we understood your REAL problem (not your
> request, we understand that) we could probably help you find a
> faster,
> more robust solution than the one you are proposing.
> 
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine
> 

Then, no, without some form of looping control (v5.0+ and SPROCs) you
have no chance of splitting a single row into clones of itself. I
think, though, that it will be more efficient to do what you want to do
client-side (in your application) than it will be to try it server-side
(using SQL statements).

Shawn Green

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

Reply via email to