Hello!
I have a query with multiple table joints and where clauses. Tables are huge and query runs for a very long time. I need to run another query, which is exactly the same apart for one Where clause (first time price = "P", second time price = "S"). I use this for BIRT report, which means I need to have a result of there two queries at the same time. I can run them at the same time, but because they are both huge it takes a Long time. I wonder if I can make only one query, will it be faster? And if it will- what’s the best way to make it?
Thank you for your help!
Please let me know if it is not clear.
natashenka_66
0
Newbie Poster
Recommended Answers
Jump to PostSince you want to run exactly the same query and check only for one condition, you can do it this way.
$query="select * from huge_table where conditions joins etc"; $result=mysql_query($query); $price_p=array(); $price_s=array(); while($row=mysql_fetch_array($result,MYSQL_ASSOC)){ if($row['price']=="P"){ array_push($price_p,$row['price']); } if($row['price']=="S"){ array_push($price_s,$row['price']); } }
So, by the end of the execution …
All 3 Replies
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
natashenka_66
0
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.