ptoki
Mamy tabelke zawierajaca kolumny:
czas,nazwa, czas_trwania
Czyli np.
2012-03-21,aaa, 20
2012-03-21,aaa, 21
2012-03-21,aaa, 30
2012-03-21,aaa, 35
2012-03-20,aaa, 10
2012-03-20,aaa, 11
2012-03-20,aaa, 20
2012-03-20,aaa, 25
Jak wyciagnac: ilosc wartosci pod progiem, nad progiem i ich stosunek dla kazdego dnia?
Czyli w rezultacie dla progu np 27:
2012-03-20, 4, 0, 1
2012-03-20, 2, 2, 0,5
fajnie by bylo jakby dalo sie wyciagnac to jednym sql-em ale niezbyt skomplikowanym. To BSM-owe api nie umie zbyt dużo.
Cytat:
Inner selects and joins are not supported, with one exception: an inner
select can be used to return the values for an IN clause.
Wolalbym nie obrabiac tego w php tylko dostac gotowy wynik z zapytania.
Od biedy wystarczy mi sam stosunek wartosci dla kazdego dnia.
Inicjalna wersja zapytania w luznej notacji:
select byTime(timestamp,40,1,0) (taki ichni distinct agregujacy czas), name, value from table where timestamp between wczoraj and dzis and value < 27;
Jak teraz ja zmodyfikowac zeby dostac te jedna/trzy wartosci?
Bo na moje oko to chyba sie nie da...
Ponizej wycinek dokumentacji co jest do dyspozycji:
The language supported is a subset of SQL and supports these keywords,
modifiers, and operators:
➤ SELECT
➤ WHERE
➤ FROM
➤ TOP
➤ HAVING
➤ Aliasing with the AS keyword
➤ Logical operators OR , AND , NOT
➤ DISTINCT modifier (only supported for select list items)
➤ IN operator. Inner selects can be used to return the values for the IN
operator.
➤ BETWEEN operator
➤ IS NULL (IS NOT NULL is not supported)
➤ LIKE. The wildcard character is the asterisk (*). Do not use the percent
sign (%). The asterisk can not be used by itself (LIKE *). It must be used
with other characters.
➤ Mathematical operators: +, -, *, /, (, )
➤ Comparators: =, IS, !=, <>, >, >=, <, <=
➤ ORDER BY and the ASC and DESC modifiers
Supported Functions
The supported functions are as follows:
➤ MAX
➤ MIN
➤ SUM
➤ COUNT
➤ AVG
➤ STDDEV
➤ SUMOFSQR
➤ LOG
➤ CEIL
➤ FLOOR
➤ MOD
➤ SQRT
➤ REPLACENULL (equivalent to Oracle’s NVL and Microsoft SQL Server’s
ISNULL)
➤ IF
➤ "byTime Function" described on page 297
czas,nazwa, czas_trwania
Czyli np.
2012-03-21,aaa, 20
2012-03-21,aaa, 21
2012-03-21,aaa, 30
2012-03-21,aaa, 35
2012-03-20,aaa, 10
2012-03-20,aaa, 11
2012-03-20,aaa, 20
2012-03-20,aaa, 25
Jak wyciagnac: ilosc wartosci pod progiem, nad progiem i ich stosunek dla kazdego dnia?
Czyli w rezultacie dla progu np 27:
2012-03-20, 4, 0, 1
2012-03-20, 2, 2, 0,5
fajnie by bylo jakby dalo sie wyciagnac to jednym sql-em ale niezbyt skomplikowanym. To BSM-owe api nie umie zbyt dużo.
Cytat:
Inner selects and joins are not supported, with one exception: an inner
select can be used to return the values for an IN clause.
Wolalbym nie obrabiac tego w php tylko dostac gotowy wynik z zapytania.
Od biedy wystarczy mi sam stosunek wartosci dla kazdego dnia.
Inicjalna wersja zapytania w luznej notacji:
select byTime(timestamp,40,1,0) (taki ichni distinct agregujacy czas), name, value from table where timestamp between wczoraj and dzis and value < 27;
Jak teraz ja zmodyfikowac zeby dostac te jedna/trzy wartosci?
Bo na moje oko to chyba sie nie da...
Ponizej wycinek dokumentacji co jest do dyspozycji:
The language supported is a subset of SQL and supports these keywords,
modifiers, and operators:
➤ SELECT
➤ WHERE
➤ FROM
➤ TOP
➤ HAVING
➤ Aliasing with the AS keyword
➤ Logical operators OR , AND , NOT
➤ DISTINCT modifier (only supported for select list items)
➤ IN operator. Inner selects can be used to return the values for the IN
operator.
➤ BETWEEN operator
➤ IS NULL (IS NOT NULL is not supported)
➤ LIKE. The wildcard character is the asterisk (*). Do not use the percent
sign (%). The asterisk can not be used by itself (LIKE *). It must be used
with other characters.
➤ Mathematical operators: +, -, *, /, (, )
➤ Comparators: =, IS, !=, <>, >, >=, <, <=
➤ ORDER BY and the ASC and DESC modifiers
Supported Functions
The supported functions are as follows:
➤ MAX
➤ MIN
➤ SUM
➤ COUNT
➤ AVG
➤ STDDEV
➤ SUMOFSQR
➤ LOG
➤ CEIL
➤ FLOOR
➤ MOD
➤ SQRT
➤ REPLACENULL (equivalent to Oracle’s NVL and Microsoft SQL Server’s
ISNULL)
➤ IF
➤ "byTime Function" described on page 297
