Jump to content
Sign in to follow this  
JimTrail

Love the SQL section, makes MySQL easier, question about DISTINCT

Recommended Posts

Hello W3Schools Forum!
This website keeps getting better. Used to I hardly ever visited it. Now it's one of my primary go-to destination points for programming information. I really do appreciate the information.
I have got a question about the DISTINCT.
I cannot get the two column format to work.
SELECT DISTINCT column_name, column_name // Can't get this one to work.
FROM table_name;
I can get the query to work with one column.
SELECT DISTINCT column_name // It works fine using just one column.
FROM table_name;

 

It's worth noting. I have got a GoDaddy shared hosting. GoDaddy technical support says the hosting is on one of the older machines. The highest version of PHP is PHP 5.4 on the server.

 

It's probably got an older version of MySQL, also. That could be the problem. I have been with GoDaddy since 2003. I am starting to look around for other hosting providers.

 

:)

 

 

Share this post


Link to post
Share on other sites

When you use DISTINCT on multiple columns, the only thing that is distinct is the combination of the column's values.

If the values of each column can be "A" and "B", the query for two columns could only return a maximum of four results: AA, AB, BA and BB

  • Like 1

Share this post


Link to post
Share on other sites

When you use DISTINCT on multiple columns, the only thing that is distinct is the combination of the column's values.

If the values of each column can be "A" and "B", the query for two columns could only return a maximum of four results: AA, AB, BA and BB

 

Thanks.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...