Page 1 of 1

MYSQL Query

Posted: Sun Jul 27, 2003 6:03 pm
by szms
Here is data tables in mysql;

Function_ID | Domain_ID | Order_No |
+-------------+-----------+----------+
| 1 | 3 | 1 |
| 2 | 6 | 1 |
| 3 | 4 | 1 |
| 5 | 4 | 1 |
| 6 | 6 | 1 |
| 7 | 4 | 1 |
| 8 | 5 | 1 |
| 10 | 3 | 1 |
| 11 | 3 | 1 |
| 12 | 3 | 1 |
| 13 | 3 | 1 |
| 14 | 4 | 1 |
| 15 | 6 | 1 |
| 16 | 5 | 1 |
| 17 | 5 | 1 |
| 18 | 4 | 1 |
| 3 | 3 | 2 |
| 5 | 3 | 2 |
| 6 | 6 | 2 |
| 7 | 3 | 2 |
| 10 | 2 | 2 |
| 13 | 3 | 2 |
| 14 | 3 | 2 |
| 15 | 2 | 2 |
| 16 | 3 | 2 |
| 18 | 3 | 2 |
| 13 | 3 | 3 |
| 15 | 4 | 3 |
+-------------+-----------+----------

I am looking for a query which will give the unique Function_ID that appears only once in the table, i.e.
Function_ID | Domain_ID | Order_No |
| 1 | 3 | 1 |
| 2 | 6 | 1 |
| 8 | 5 | 1 |
| 11 | 3 | 1 |

and so on.

Can you tell me the query?

Posted: Sun Jul 27, 2003 7:08 pm
by sitething
I named the table func1 for this example

Code: Select all

SELECT function_id
FROM func1
GROUP BY function_id
HAVING count( function_id ) = 1 LIMIT 0 , 30