Jump to content

Splitting Queries or something


radar

Recommended Posts

Okay I have a site that has different institutions and different advisors..  I need a list of the different advisors split up by their institutions and in alphabetical order...  Im not sure where to go from the code I have..  Now I am using smarty but all that works...

[code]
<?php
case 'list_all_advisors';

/*
$data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id, count(*) as tot_rec, avg(total_score) as avg_score, recommendations.total_score FROM advisors, recommendations
WHERE advisors.advisor_id = recommendations.advisor_id GROUP BY advisor_id");
///
*/

$data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id, advisors.institute_id, count(recommendations.rec_id) as tot_rec, avg(recommendations.total_score) as avg_score, recommendations.total_score FROM recommendations RIGHT JOIN advisors ON recommendations.advisor_id = advisors.advisor_id GROUP BY advisors.institute_id");
//$data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id FROM advisors ORDER BY advisors.lname");


$i = 0;
foreach ($data as $this_adv){
$adv_stats = $turbo->get_stats_adv($this_adv[advisor_id]);
$data[$i][sd] = $adv_stats[sd];
$data[$i][av] = $adv_stats[av];

$i++;
}

$turbo->assign('rec', $rec);
$turbo->assign('data',$data);
//print_r($data);
//print_r($adv_stats);
$page = 'list_advisors';
break;?>
[/code]

I found the real cause of my problems and the post has been edited acordingly.
any help on this is greatly  appreciated...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.