var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
I was wondering if these two queries (or ways to get the total number of unique names in a table) are the same?
1. SELECT DISTINCT names FROM users;
and then get from mysql_num_rows
2. SELECT COUNT(DISTINCT names) FROM users;
And if they're the same, I guess the #2 is more efficient?
It would depend on your scenario. If you only want the number of distinct values, then yes, #2 is the best path. If you want to use the distinct values in addition to knowing the number of rows then #1 would be your best path.
Log in with your username and password
Forgot your password?
Subscribe to dBforums Brief to receive special offers from dBforums partners and sponsors