How do I get computed column using db_select? I require sum(points)? Any help on what to add in the sample code given below?

$query = db_select('digitaliq_question_points','n')
  -&gt;fields('n',array('points'))
  -&gt;condition("node_id", $node-&gt;nid, '=')
  -&gt;condition('n.fld_group', $fields, 'IN');

$points = $query-&gt;execute()-&gt;fetchAll();
You can make use of the addExpression() method:

$query = db_select('digitaliq_question_points','n')
  -&gt;fields('n',array('points'))
  -&gt;condition("node_id", $node-&gt;nid, '=') 
  -&gt;condition('n.fld_group', $fields, 'IN');

$alias = $query-&gt;addExpression('SUM(points)', 'sum_of_points');

$points = $query-&gt;execute()-&gt;fetchAll();


Obviously that might need to change slightly based on your return value/grouping requirements but that's the method you're looking for.