[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Joining tables based on scaled value of fields

Asked by peterbrowne in PHP Scripting Language, PHP and Databases, MySQL Server

I have several tables with the following fields:

node_m_data_id, timestamp, user_count

Each table is fed data from a specific node; a ten digit unix timestamp and the number of users logged into that node at that time.

I have been using the following code to display this data from each of the tables as graph overlays.

Problem is that the graph overlays are now out of sync.  Rather than joining the tables on the ids, eg node_o_data_id = node_q_data_id, the joining should occur by matching the unix timestamps.  However, the problem is the timestamps (eg 1256605740, 1256605620) will vary by hundreds of seconds for each record.  What needs to happen is to join the tables based on matched values on the timestamps, say on the thousands of seconds).  Any idea of how to do this?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
$ts_last_month = strtotime('-30 days');
 
$query = "SELECT 
node_q_data.timestamp AS timefield, 
node_k_data.user_count AS users_k, 
node_l_data.user_count AS users_l, 
node_m_data.user_count AS users_m, 
node_n_data.user_count AS users_n, 
node_r_data.user_count AS users_r, 
node_o_data.user_count AS users_o, 
node_p_data.user_count AS users_p, 
node_q_data.user_count AS users_q 
FROM 
node_k_data, 
node_l_data, 
node_m_data, 
node_n_data, 
node_r_data, 
node_o_data, 
node_p_data, 
node_q_data
WHERE 
node_k_data_id = node_q_data_id 
AND 
node_l_data_id = node_q_data_id
AND 
node_m_data_id = node_q_data_id
AND 
node_n_data_id = node_q_data_id
AND 
node_r_data_id = node_q_data_id
AND 
node_o_data_id = node_q_data_id
AND 
node_p_data_id = node_q_data_id AND node_q_data.timestamp > '$ts_last_month'";
$result = mysql_query($query, $connection) or die(mysql_error());
 
while($row = mysql_fetch_assoc($result)){  
  $timestamp =  date('d-m-y H:i',$row['timefield']);
  $users_k = $row['users_k'];
  $users_l = $row['users_l'];
  $users_m = $row['users_m'];
  $users_n = $row['users_n'];
  $users_r = $row['users_r'];
  $users_o = $row['users_o']; 
  $users_p = $row['users_p'];
  $users_q = $row['users_q'];
  echo "$timestamp;$users_k;$users_l;$users_m;$users_n;$users_r;$users_o;$users_p;$users_q\n";
}
[+][-]10/27/09 12:55 AM, ID: 25669949Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP Scripting Language, PHP and Databases, MySQL Server
Sign Up Now!
Solution Provided By: julianH
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625