Re: Help on select distinct or distinctrow?

From: Date: Wed, 01 Nov 2000 20:43:30 +0000
Subject: Re: Help on select distinct or distinctrow?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-23238@lists.php.net to get a copy of this message
On Wed, Nov 01, 2000 at 11:11:28AM -0500, Wee Chua wrote: > Hi all, > If have a result set like this, > > EmpID JobID Date > 1 1 1/1/00 > 1 2 2/1/00 > 1 3 3/1/00 > 2 4 4/1/00 > 2 5 5/1/00 > 2 6 6/1/00 > 2 7 7/1/00 > 3 8 8/1/00 > 3 9 9/1/00 > > how could I get rid of duplicate EmpID instead of showing one like example > below, do i have to use select distinct or distinctrow and group by commad > in my select statement, what is the syntax for that? > > EmpID JobID Date > 1 1 1/1/00 > 2 2/1/00 > 3 3/1/00 > 2 4 4/1/00 > 5 5/1/00 > 6 6/1/00 > 7 7/1/00 > 3 8 8/1/00 > 9 9/1/00 You can't do that. If you use GROUP BY then you have to summarize the JobID and Date columns - which isn't what you want. You can just make your application not print out the EmpID if it's the same as the row above it. Tim -- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Tim Smith <tim@mysql.com> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Development Team /_/ /_/\_, /___/\___\_\___/ Boone, NC USA <___/ www.mysql.com

« previous php.general (#23238) next »