Jump to content

how i can do sql command for this...?


Recommended Posts

hi,

 

Again here...here i have problem in sql commands..i am wondering whether is it possible for the sql to calculate average and display data as i wanted....here is my question...

I have these values in my table...like this

 

Node_id  temperature light voltage Date light accel_x accel_y mag_x mag_y mic

_______________________________________________________________________________

1            25        200   2.5    12.09.2003 0.9877  0.98765 0.766 0.654  232

1            27        466   3.4    13.04.2005 0.8776  0.53442 0.7542 0.342 76

1            34        675   2.6    12.08.2003 0.8775  0.76643 0.87654 0.654 76

1

1

2

2

3

3

4

4

5

5

 

i need to find the average for all the nodes...each nodes will collect data 5 times..the output should be like this

 

Node1   temperature  light voltage light accel_x accel_y mag_x mag_y mic

node1   23 .....

node2   34......

 

I start my command like below...It produced error results...

 

select avg(temperature),avg(light),avg(voltage),avg(accel_x),avg(accel_y),avg(mag_x),avg(mag_y) 
from suhu HAVING{(suhu.Node_ID="1","2","3","4","5}};

 

Could someone help?Do i have to come out with 5 sql commands for each node?is that possible?Any other suggestion?doi have to calculate it manually for this case?

 

 

thank you for your time...

 

Link to comment
https://forums.phpfreaks.com/topic/69613-how-i-can-do-sql-command-for-this/
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.