I'm trying to make a query that will number it's own output rows.  e.g. when
listing all the entries in a table that are related to a specific invoice,
there will be a column with a monotonically increasing integer value (1-x
where x is the number of matching entries).

I know I can easily do this with PHP after the query is generated, but I have
a generic function to create a pulldown menu selection that will work easily
if I can just get that counter column in there...

I've tried:

select tableName.*, 1 as inc, sum( inc ) from tableName;

But sum() will only accept a table column, not a display column...  I have the
Widenius MySQL book, but I haven't found anything useful in there.

If anyone has an idea, I'd appreciate it...


No, my friend, the way to have good and safe government, is not to trust it
all to one, but to divide it among the many, distributing to every one exactly
the functions he is competent to.  It is by dividing and subdividing these
republics from the national one down through all its subordinations, until it
ends in the administration of every man's farm by himself; by placing under
every one what his own eye may superintend, that all will be done for the
                -- Thomas Jefferson, to Joseph Cabell, 1816

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to