MySQL query help

From: Date: Mon, 10 Sep 2001 19:20:09 +0000
Subject: MySQL query help
Groups: php.general 
Request: Send a blank email to php-general+get-66803@lists.php.net to get a copy of this message
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... -Michael -- 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 best. -- Thomas Jefferson, to Joseph Cabell, 1816

« previous php.general (#66803) next »