Note that there are some explanatory texts on larger screens.

plurals
  1. POOptimizing a troublesome query
    primarykey
    data
    text
    <p>I'm generating a PDF, via php from 2 mysql tables, that contains a table. On larger tables the script is eating up a lot of memory and is starting to become a problem.</p> <p>My first table contains "inspections." There are many rows per day. This has a many to one relationship with the user table.</p> <p>Table "inspections"</p> <hr> id area inpsection_date inpsection_agent_1 inpsection_agent_2 inpsection_agent_3 <hr> <p>id (int)<br> area (varchar) - is one of 8 "areas" ie: Concrete, Soils, Earthwork<br> inspection_date (int) - unix timestamp<br> inspection_agent_1 (int) - a user id<br> inspection_agent_2 (int) - a user id<br> inspection_agent_3 (int) - a user id</p> <hr> <h2>Second table is the user's info. All I need is to join the name to the "inspection_agents_x"</h2> id name <hr> <p>The final table, that is going to be in the PDF, needs to organize the data by: </p> <ul> <li>by day</li> <li>by user, find every "area" that the user "inspected" on that day</li> </ul> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Concrete Soils Earthwork <br> 1/18/2011<br> Jon Doe &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X<br> Jane Doe &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X<br> </p> <p>And so on for each day. Right now I'm just doing a simple join on the names and then organizing everything on the code end. I know I'm leaving a lot on the table as far as the queries go, I just can't think of way to do it.</p> <p>Thanks for any and all help. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload