0

Hi guys i have a table with this data
______________
| site | cat |
______________
| my | sp |
| my | sp |
| my | cc |
| my | cc |
| yo | sp |
| yo | sp |
| yo | cc |
| yo | cc |
______________

my question is this:
what query will give me this result
______________
| site | cat |
______________
| my | sp |
| my | cc |
| yo | sp |
| yo | cc |
______________
i am very new to sql and relational database although very good in nosql databases.
i have also spent more than 3hours searching the net for answers but have got non.

Edited by otengkwaku

5
Contributors
6
Replies
28
Views
3 Years
Discussion Span
Last Post by otengkwaku
0

From your example it looks like you want the distinct values from the table

SELECT DISTINCT COL_NAME1, COL_NAME2 FROM...

But I doubt that is it. What exactly do you need?

0

If those columns are the extent of your fields in the table, why allow duplicates in the first place? In any event, you may be better off storing the ids (maybe integers) if these fields are foreign keys.

0

I think the problem is the way I designed my table it is all wrong thanks guys it feels good to have friends who will help if even they can't thanks this is a family

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.