0 rawad baz · November 4, 2014
Hello, i reached the tutorial about DISTINCT and LIMIT...And i was wondering, does LIMIT gives you distinct results when using with it one number or two numbers?
IF not can i use with it the command DISTINCT?
Thank you

Post a Reply


Oldest  Newest  Rating
-1 rawad baz · November 5, 2014
Thank you man
+1 Jonathan Hickey · November 5, 2014

Difference between LIMIT and DISTINCT.

Imagine a table with 200 rows in it, with only one column in the table and a column can be ether "hello" or "good bye"

Select * from Table 
This returns 200 rows

Select * from Table Limit 5
This will return only the first 5 rows

If you change limit to 1 then it will only return 

Select Distinct(Column)  from Table
Will return both "hello" and "good bye" 

Now if we add the both of them together
Select Distinct(Column)  from Table Limit 1
will on return the first row of the results of the Distinct query.

Hope that helps
  • 1

SQL & Databases


Everything SQL and Databases related in here!

Bucky Roberts Administrator