How get values from database scadalts from last day

Grzesiek

I need to get data from DB scadalts from last day.

I have data in table pointValues where is column pointValue and ts but is not timestamp.

Column ts is type BIGINT(20)

Checking ts is unixtime

     SELECT 
        pointValue,
        ts, 
        from_unixtime(ts),
        YEAR(from_unixtime(ts)),
        MONTH(from_unixtime(ts)),
        DAY(from_unixtime(ts))
     FROM 
        pointValues;

The result null is wrong is not unixtime.

I don't know how to create condition where because - I don't know how to interpret value in column ts.

Grzesiek

Column ts should be interpreted with greater accuracy.

eg:

SELECT 
    pointValue,
    ts, 
    from_unixtime(ts/1000),
    YEAR(from_unixtime(ts/1000)),
    MONTH(from_unixtime(ts/1000)),
    DAY(from_unixtime(ts/1000))
 FROM 
    pointValues;

And we may get values from last day eg:

SELECT 
    pointValue,
    ts, 
    YEAR(from_unixtime(ts/1000)),
    MONTH(from_unixtime(ts/1000)),
    DAY(from_unixtime(ts/1000))
FROM 
    pointValues
WHERE
    YEAR(from_unixtime(ts/1000)) = YEAR(NOW() - INTERVAL 1 day) and
    MONTH(from_unixtime(ts/1000)) = MONTH(NOW() - INTERVAL 1 day) and
    DAY(from_unixtime(ts/1000)) = DAY(NOW() - INTERVAL 1 day)

Thanks

Maybe it will be useful also

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get first and last values from list<string>?

From Dev

Get Last NOT NULL values from all the columns

From Dev

MomentJS - How to get last day of previous month from date?

From Dev

How to get the last value from the database

From Dev

How to get last inserted record from core database?

From Dev

How to get data from last hour, last day and last month with one query?

From Dev

How to get second last row from a mysql database?

From Dev

How to get last Day of the Month from a date string in C#?

From Dev

Get the first and last day of a year from a timestamp

From Dev

How to get values from database to jcombobox?

From Dev

How to get last 5 mins record from SQL database table?

From Dev

How to use Apache DateUtils to get previous month from first day to last day with time [JAVA]?

From Dev

Get last entry from each user in database

From Dev

Get query from mysql database group by day

From Dev

Umbraco: Get "Last Edits" values from content

From Dev

Android how to get values from columns in a sqlite database

From Dev

How to get the last 5-10 message from a database?

From Dev

How to get the last value from the database

From Dev

Efficient way to get last record from the database

From Dev

How to get values of the children from a element except the last one jquery?

From Dev

Get Values from last Row of .csv File

From Dev

How to get last 5 mins record from SQL database table?

From Dev

How to get values from database from current date to last 5 days

From Dev

How to get session values from database in laravel

From Dev

How to get last values from a log file

From Dev

get values from table in column from database

From Dev

How to only get the day from the date stored in database in java?

From Dev

How to get only last iteration value while fetching data from the database,I've tried Getting values as JSON format

From Dev

How to get last insert id from mysql database in php?

Related Related

  1. 1

    How to get first and last values from list<string>?

  2. 2

    Get Last NOT NULL values from all the columns

  3. 3

    MomentJS - How to get last day of previous month from date?

  4. 4

    How to get the last value from the database

  5. 5

    How to get last inserted record from core database?

  6. 6

    How to get data from last hour, last day and last month with one query?

  7. 7

    How to get second last row from a mysql database?

  8. 8

    How to get last Day of the Month from a date string in C#?

  9. 9

    Get the first and last day of a year from a timestamp

  10. 10

    How to get values from database to jcombobox?

  11. 11

    How to get last 5 mins record from SQL database table?

  12. 12

    How to use Apache DateUtils to get previous month from first day to last day with time [JAVA]?

  13. 13

    Get last entry from each user in database

  14. 14

    Get query from mysql database group by day

  15. 15

    Umbraco: Get "Last Edits" values from content

  16. 16

    Android how to get values from columns in a sqlite database

  17. 17

    How to get the last 5-10 message from a database?

  18. 18

    How to get the last value from the database

  19. 19

    Efficient way to get last record from the database

  20. 20

    How to get values of the children from a element except the last one jquery?

  21. 21

    Get Values from last Row of .csv File

  22. 22

    How to get last 5 mins record from SQL database table?

  23. 23

    How to get values from database from current date to last 5 days

  24. 24

    How to get session values from database in laravel

  25. 25

    How to get last values from a log file

  26. 26

    get values from table in column from database

  27. 27

    How to only get the day from the date stored in database in java?

  28. 28

    How to get only last iteration value while fetching data from the database,I've tried Getting values as JSON format

  29. 29

    How to get last insert id from mysql database in php?

HotTag

Archive