Search code examples
vb.netms-access-2007

how to sum up particular record in table based on two parameters in ms access using vb.net?


i have table named as productstock. In that table i have described the columns like below structure

Particulars     Name     Qty  
30              Red       30  
40              Green     40  
50              Yellow    10  
30              Red       20  
50              Yellow    40  
60              Pink      20  

i want to query the result from the above table like below structure.

Particulars     Name     Qty  
30              Red       50  
40              Green     40  
50              Yellow    50  
60              Pink      20  

how do i get achieved this query in ms access query using vb.net? is this possible?


Solution

  • Select productstock.Particulars, productstock.Name, SUM(productstock.Qty) 
    From productstock 
    Group By productstock.Particulars, productstock.Name 
    Order By productstock.Particulars