I need help on a query regarding fetching data from a database file
up vote
0
down vote
favorite
I have a database where a lot of sensors are sending data. I need to extract the most recent data from Pin 21,20,16,12.
I have written this query but so far it only returns me the last 4 values of the database and not the latest from from all of these pins. What am I doing wrong?
select * from Temperature where Pin in (21,20,16,12) and Module =1 order by S_No desc limit 4
Click here to download Database file
database sqlite sqlite3
add a comment |
up vote
0
down vote
favorite
I have a database where a lot of sensors are sending data. I need to extract the most recent data from Pin 21,20,16,12.
I have written this query but so far it only returns me the last 4 values of the database and not the latest from from all of these pins. What am I doing wrong?
select * from Temperature where Pin in (21,20,16,12) and Module =1 order by S_No desc limit 4
Click here to download Database file
database sqlite sqlite3
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a database where a lot of sensors are sending data. I need to extract the most recent data from Pin 21,20,16,12.
I have written this query but so far it only returns me the last 4 values of the database and not the latest from from all of these pins. What am I doing wrong?
select * from Temperature where Pin in (21,20,16,12) and Module =1 order by S_No desc limit 4
Click here to download Database file
database sqlite sqlite3
I have a database where a lot of sensors are sending data. I need to extract the most recent data from Pin 21,20,16,12.
I have written this query but so far it only returns me the last 4 values of the database and not the latest from from all of these pins. What am I doing wrong?
select * from Temperature where Pin in (21,20,16,12) and Module =1 order by S_No desc limit 4
Click here to download Database file
database sqlite sqlite3
database sqlite sqlite3
asked yesterday
Usman Khan
475
475
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
The answer was to add group by Pin on the end.
select * from Temperature where Pin in (21,20,16,12) and Module =1 group by Pin
I am so stupid
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The answer was to add group by Pin on the end.
select * from Temperature where Pin in (21,20,16,12) and Module =1 group by Pin
I am so stupid
add a comment |
up vote
0
down vote
The answer was to add group by Pin on the end.
select * from Temperature where Pin in (21,20,16,12) and Module =1 group by Pin
I am so stupid
add a comment |
up vote
0
down vote
up vote
0
down vote
The answer was to add group by Pin on the end.
select * from Temperature where Pin in (21,20,16,12) and Module =1 group by Pin
I am so stupid
The answer was to add group by Pin on the end.
select * from Temperature where Pin in (21,20,16,12) and Module =1 group by Pin
I am so stupid
answered yesterday
Usman Khan
475
475
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349293%2fi-need-help-on-a-query-regarding-fetching-data-from-a-database-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown