Jump to content

many mysql queries or one to two foreach statments


c_shelswell

Recommended Posts

Hi i'm just wondering - i've got a statistics page to make where i need to get some numerical data from my database and some i need to count the number of occurences of a word. I need to get bits from a few different tables with about 80k+ records in some of them.

 

I could get most of the data in 1 query i think but then i'd have to run a foreach to count the data or I could do about 10 seperate queries.

 

What do you think would be quicker?

 

Cheers

Link to comment
Share on other sites

thing is i need to to a sum(all_subscribed) from one table then another count(users_with_only_1email_error) so my query would end up $sql = "select sum(subscribed), count(mail_delivery_errors) from table1, table2 where mail_delivery_errors='perm'" so it's kind of not going to work i think.

 

I could do one or two big queries select * then foreach all my data. I think the queries will probably be the easier bet though.

 

Cheers

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.