Jump to content

trying to consolidate several queries...


glennn.php

Recommended Posts

 

i'm going to end up running about 10 queries according to some previous queries; i knew better than to think what i tried below would work, but i'm hoping at least someone can see what i'm trying to accomplish (running a single query instead of running 10 seperate queries when the page is called)...

 

could someone see what i'm attempting and describe how and if this can even be done?

 


$query = mysql_query("SELECT * FROM rel_offering, rel_carnegie WHERE rel_offering.offering IN ($offerings), rel_carnegie.cc2001 IN ($carn_code_sql)");



while($row = mysql_fetch_array( $query )) {
echo $row['offering_text']."<br>";
echo $row['cc_description']."<br>";
}

... and the tables...


accreditations
administrators
characteristics
rel_affiliation
rel_calendar
rel_carnegie
rel_emphasis
rel_inst_type
rel_irs_status
rel_mpc
rel_offering
rel_sex
rel_states


 

thanks so much,

GN

Link to comment
https://forums.phpfreaks.com/topic/124676-trying-to-consolidate-several-queries/
Share on other sites

The INs are subqueries I'm assuming.  Errr, are you selecting an entire table?  If so, it might be slightly better to do a self join (or a subquery with criteria), but chances are, you're stuck doing a subquery.

 

 

Just of curiosity, what is an example query?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.