Re: mysql self-join?
| From: | John McKown | Date: | Sat, 02 Sep 2000 05:28:32 +0000 |
| Subject: | Re: mysql self-join? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14907@lists.php.net to get a copy of this message | ||
Hum, I've noticed that a lot of people ask MySQL questions here. Is this
normal? I don't mind, I'm just curious. Rephrasing your question a might
is: can I display all records in the table "foo" where the value in
"field" in non-unique? Well, I don't see how you can get this information
from a self-join. Oh, you can use a self-join in MySQL. I just can't
figure out a way to answer the above question with it.
In PostgreSQL, you can answer the above question with the query:
SELECT * FROM table WHERE (SELECT field FROM table GROUP BY field HAVING
COUNT(field)>1);
This query gets a syntax error in MySQL 2.23.23-beta, which is what I'm
running at home.
Wish I could be more helpful,
John
On Sat, 2 Sep 2000, Josh McDonald wrote:
> Hi,
> Can I do a self-join in mysql without any troubles? What
> I'm trying to do is find all records in foo where bar is a duplicate
> entry. Can I do this in mysql?
>
> -Gfunk007
>
> :::: visit me - http://www.gfunk007.com/ :::: ICQ 74477509 ::::
>
>
>