SQL query prob
| From: | Russ | Date: | Thu, 18 Jul 2002 01:44:05 +0000 |
| Subject: | SQL query prob | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20609@lists.php.net to get a copy of this message | ||
I'll try that one again....
I have a query:
$sql = "SELECT * FROM contacts ORDER BY ContactType";
There are two types of contacts:
* Commissioners
* Staff
As they are ordered by the ContactType then 'Commissioners' are
displayed first followed by 'Staff'.
I'd like to be able to display a heading on the page at the point of the
FIRST instance of 'Commissioners' and at the FIRST instance of 'Staff'.
As I'm using a while loop in my PHP script then at present such a
heading would be displayed atop *each* item would it not?
I think I need to use some kind of COUNT() but am unsure how to deploy
it.
Can anyone help me out?
Cheers.
Russ
Mr Russ Michell
Web Applications Developer
Itomic.com
Email: russ@itomic.com
Tel: +61 (0)8 9321 3844
Fax: +61 (0)8 6210 1364
Post: PO Box 228, Innaloo, WA 6918, Australia
Street: Suite 24, 158 William St, Perth, WA 6000, Australia
"No proof of existence is not proof of non-existence."
(Physicist: Stanton T. Friedman on Debunking Ufology)