Hi All, I have a database with multiple records. See Table Structure Below :
id Subject Sub_category Marks User_Type 1 Science Physics 4 tom 2 Science Physics 2 tom 3 Science Physics 1 tom 4 Science Chemistry 4 tom 5 Science Chemistry 5 tom 6 Science Biology 5 tom 7 Science Biology 3 tom 8 Math Alebra 2 tom 9 Math Alebra 3 tom 10 Math Statics 5 tom 11 Math Statics 3 tom 10 English Grammer 5 tom 11 English Grammer 1 tom 10 English Grammer 3 tom 11 English Theory 1 tom 11 English Theory 5 tom
Now I needs a query which shows addition marks of particular Sub_category, with count.. See below.
Subject Sub_category Marks User_Type Science Physics 7 tom Science Chemistry 9 tom Science Biology 8 tom Math Alebra 5 tom Math Statics 8 tom English Grammer 9 tom English Theory 6 tom
<br /> Can any one have an idea, kindly share with me.
select subject,sub_category,sum(marks) as marks,user_type from yourTbl group by subject,sub_category,user_type
SELECT Subject , Sub_category , SUM(Marks) AS Marks , User_Type FROM YourTable GROUP BY Subject , Sub_category , User_Type
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)