Re: some data output formatting and grouping question...
| From: | Bastian Vogt | Date: | Mon, 02 Dec 2002 08:08:07 +0000 |
| Subject: | Re: some data output formatting and grouping question... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126682@lists.php.net to get a copy of this message | ||
Hi,
if I got you right, you want to output each value for "Y" and then print out
how often this value appears?
If yes, you could try this:
SELECT Y, COUNT(Y) AS NUMBER FROM TABLE GROUP BY Y HAVING U = 'me'
Well, it's Monday morning and I don't know, if this will work, but I guess
it does! ;-)
Just try it out in phpmyadmin or so...
Regards,
Bastian
Victor schrieb:
> I just have a fucking mental block; I cannot at all conceive the
> necessary syntax to or even the theoretical algorithm that I need, to do
> the following:
>
> Consider the following table:
>
> U | X | Y
> --|---|--
> me|001|0a
> me|002|0a
> me|003|0a
> me|002|0b
> me|003|0b
> me|004|0b
> ..|...|..
>
> then the code says:
>
> SELECT * FROM Y WHERE U = me
>
> So now what?
> - remember I do not know the value of Y, so it has to be an automatic
> thing; I can't just say ... WHERE U = me AND Y = a.
>
> I want this output:
>
> 0a
> 001
> 002
> 003
> _______________________ (<hr>)
>
> 0b
> 002
> 003
> 004
>
> How the hell do I do that? I can't think of the goddamn' syntax!
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca