I am using mysql query to generate a report. I would like to know can whether we can use group by clause on data itself? Let me elaborate. Let'ss asssume I have following table called employee and database is myrecords.
Now I want to display the records based on the description. Partiularly, I am looking for the data based on description only "senior executive" and "HR". I do not wish to take any other records. In short, I am looking for the data based on the data. Can I extract data from data? Therefore, I am using group by description clause. How can I use it?
Check out SELECT DISTINCT this might help you without using GROUP BY. For example if you have a table with a column and you only want to get the unique entries for this column then SELECT DISTINCT fieldname FROM table will return these results.
The GROUP BY clause in a select can be used to generate a similar type result, however, it is more powerful because it can also return to you more information about what you are grouping on. Here is an online tutorial about GROUP BY SQL GROUP BY - SQL Tutorial