- Forums
- MySQL
- How To Select Unique Rows From Mysql Distinct Keyword Query
This Page Contains information about How To Select Unique Rows From Mysql Distinct Keyword Query By Wallpaperama in category MySQL with 0 Replies. [909], Last Updated: Sat May 18, 2024
Wallpaperama
Mon Dec 08, 2008
0 Comments
5169 Visits
distinct()
ok, lets say you want to do a mysql query but you dont want the quieries to repeat. right.
well, you can do a distinc query in mysql. Getting a list of unique values from a MySQL column is easy if you know how. so how do you select unique rows? there are many ways to select a mysql unique key or mysql unique constraint, but the best and easiest way to get mysql unique index is by mysql unique column which i use for an online mysql guide mysql distinct keyword by selecting unique identifier.
for example, lets say i have these rows:
1. wallpaperama free wallpapers
2. wallpaperama wallpapers
3. wallpaperama free wallpapers
4. free wallpapers
5. free wallpaperama
6. free wallpapers
7. wallpaperama wallpapers
8. free wallpaper
9. wallpaperama free
ok if you look at the 9 rows above, you will see that there are some rows that are identical. so i dont want to select the ones that repeat, i only want the ones that dont repeat which are unique or one of a kind. so this is how my list should come out
1. wallpaperama free wallpapers
2. wallpaperama wallpapers
3. free wallpapers
4. free wallpaperama
5. wallpaperama free
so by doing this, i can gnore duplicate entries in MySQL selecting and using DISTINCT keyword
and this is how my sql querie would look like:
$sql = "SELECT DISTINCT(keywords) FROM searches ORDER BY id ASC";