N/APosted on - 10/01/2011
I am currently working on a query however, the results i have been getting are not grouped the way I wanted them to.
I am not very certain as well if the grouping I had in mind is possible.
Can somebody check the codes I am working on below and help me?
What I wanted to do is classify the result by Job_Operation.Job_Operation, and then filter them out after. Is this feasible?
How to get right grouping in an SQL query
The GROUP BY statement is used in conjunction with the aggregate (like sum(), count() and etc.) functions to group the result-set by one or more columns. If you would try to use aggregate functions without any group, the result of would be equal for all rows. The result of the query returns unique value of the group column. Also, you can perform sub group of a group column. The general query goes like this:
SELECT column_name, aggregate_function(column_name)
WHERE column_name operator value
GROUP BY column_name
In your case, since you are not using any aggregate functions, you don't need to have a group. What do I think is you want to sort the result of this query. Am I right?