Welcome Guest, Not a member yet? Register   Sign In
need help with sql query using Active Record plz
#1

[eluser]Abu eldahab[/eluser]
Hello All, when i'm testing this query in phpmyadmin it's work fine
Code:
SELECT  `tariffdesc` , SUM(  `duration` ) AS duration, SUM(  `cost` ) AS cost, COUNT(  `id_call` ) AS id_call
FROM  `calls`
WHERE  `caller_id` =  'moh'
GROUP BY  `tariffdesc`


the problem i tried to use Active Recored to get same data from my table i failed to make it work


any help with this query ?

Regards
#2

[eluser]davidbehler[/eluser]
Code:
$this->db->select('tariffdesc');
$this->db->select('SUM(duration) AS duration', FALSE);
$this->db->select('COUNT(id_call) AS id_call', FALSE);
$this->db->from('calls');
$this->db->where('caller_id', 'moh');
$this->db->group_by('tariffdesc');

have fun Smile
#3

[eluser]Abu eldahab[/eluser]
[quote author="waldmeister" date="1265584630"]
Code:
$this->db->select('tariffdesc');
$this->db->select('SUM(duration) AS duration', FALSE);
$this->db->select('COUNT(id_call) AS id_call', FALSE);
$this->db->from('calls');
$this->db->where('caller_id', 'moh');
$this->db->group_by('tariffdesc');

have fun Smile[/quote]


Dear waldmeister ,

Thank you very much for your help

Best Regards
#4

[eluser]mineass[/eluser]
[quote author="waldmeister" date="1265584630"]
Code:
$this->db->select('tariffdesc');
$this->db->select('SUM(duration) AS duration', FALSE);
$this->db->select('COUNT(id_call) AS id_call', FALSE);
$this->db->from('calls');
$this->db->where('caller_id', 'moh');
$this->db->group_by('tariffdesc');

have fun Smile[/quote]

if u use false in select once, AR will not escape any of other lines in this query




Theme © iAndrew 2016 - Forum software by © MyBB