Tag Info

New answers tagged

3

Actually, I want to give a comment about your question. I can't to do that because I have low reputation here. So, I decided to answer whether it fits with your question or not. Let's I start. Would you like determine "query is inserted" first? I have an assumption about your "query is inserted". "Query is inserted" is every query is inserted or affected ...


2

First, a crucial mistake of the queries: LIMIT without ORDER BY does not guarantee consistent results. If you get correct results using LIMIT without ORDER BY, it's only by accident. The results you got from running the queries in PHPMyAdmin was only accidental. There is no guarantee that you'll get the same results if you run the same queries tomorrow. ...


0

Solved it by adding ORDER BY time_stamp DESC LIMIT 1 to the SQL. Must have been a silent 'order by' inserted by PHPmyadmin?


0

I think the answer depends upon what you are trying to achieve and how the data will be used. Think more about the application design requirements. From what you describe, I would recommend a single table with 1 key, datetime & value per row. ( I think this is what you describe in your 2nd option) The reason I say this is this is that its easier ...


1

I'd go with the 2nd approach. Don't be afraid of Join(t)s. Here are some reasons Fast enough. Chances are extremly low that you'd rely on the additional speed you gain from a flat structure, if there is any. It's not worth such an ugly hacky design More flexible. You can add a 5th timeframe per value later and don't end up with empty columns Less ...



Top 50 recent answers are included