Re: special join
The Natural Philosopher <[email protected]> Mon, 7 Sep 2020 13:16:32 +0100
| Newsgroups | comp.databases.mysql |
|---|---|
| Organization | A little, after lunch |
| Message-ID | <[email protected]> |
On 07/09/2020 12:52, Nikolaj Lazic wrote: > Dana Mon, 7 Sep 2020 12:26:14 +0200, Jan Novak <[email protected]> napis'o: >> Hi, >> >> i have a table "server" with auto_increment field ID and a table "ip", >> with a filed "SERVER_ID" corrosponding to "server.ID" >> >> select ip.VALUE as "ip" from server, ip where server.DELETED=0 and >> server.ID=ip.SERVER_ID >> >> If in "ip" table for the server are more then one ip adress are saved, i >> get in my results the server also more then one time listed. >> >> My question is: how can i get only the server with the first IP from the >> ip Table, if more then one ip's saved there. > > group by... count... and then select those >1. > > https://www.w3resource.com/sql/aggregate-functions/count-with-group-by.php > distinct.. Not unique as I said earlier -- When plunder becomes a way of life for a group of men in a society, over the course of time they create for themselves a legal system that authorizes it and a moral code that glorifies it. Frédéric Bastiat