Hi,
Could someone give me a basic explaination of what GROUP BY does? It appears to me to be similar to DISTINCT.
Does it just group together rows with the same value?
So in the following example -
SELECT colname1, colname2, colname3
FROM tablename
WHERE colname1 = something
GROUP BY colname1
does it just group together all the colname1 values that are the same and only return one result for that value???
What happens if I put two colnames in the GROUP BY like -
SELECT colname1, colname2, colname3
FROM tablename
WHERE colname1 = something
GROUP BY colname1, colname2
what does that do??
I have read through a lot of posts and tutorials but kind find a simple explaination.
Thank you.
Simon.
Could someone give me a basic explaination of what GROUP BY does? It appears to me to be similar to DISTINCT.
Does it just group together rows with the same value?
So in the following example -
SELECT colname1, colname2, colname3
FROM tablename
WHERE colname1 = something
GROUP BY colname1
does it just group together all the colname1 values that are the same and only return one result for that value???
What happens if I put two colnames in the GROUP BY like -
SELECT colname1, colname2, colname3
FROM tablename
WHERE colname1 = something
GROUP BY colname1, colname2
what does that do??
I have read through a lot of posts and tutorials but kind find a simple explaination.
Thank you.
Simon.