I need to get cloudwatch log insights for spot terminations on only few days of the week (ex: Friday, saturday, sunday and monday). For last 3 months, I need to get the insights, entire date range can be selected through UI, but I need to filter above few days. Any help would be appreciated.
Current query without the filter for days.
filter #message like /terminate/
| stats count(*) as exceptionCount by bin(24h) as binh
| sort binh desc
Thanks in advance.
Related
need help with this query DB2 IBM
SELECT
ABALPH AS Kunde,
SDLITM AS Artikel,
SDDSC1 AS Beschreibung,
SDSOQS AS Menge, date(digits(decimal(SDIVD+1900000,7,0))) AS Invoice,
decimal(SDUPRC/10000,15,2) AS Einzelpreis,
decimal(SDAEXP/100,15,2) AS Gesamtpreis,
SDDOCO AS Dokument,
AIAC01 AS Region
Now my question is , how can I get the today date minus 1 day ?
Thank you so much
have test it with ADD_DAYS doesn´t work.
I do not see the point in your query where a date is referenced but your query seems incomlete anyways because join contions are missing.
In general you get todays date with current date and you get yesterday with current date - 1 day
Check out this query:
SELECT current date, current date - 1 day
FROM sysibm.sysdummy1
Per the DB2 documentation, ADD_DAYS is valid with negative numbers for previous days. See example 4 on that page. So usage like this should have worked:
ADD_DAYS(DATE(...), -1)
or
ADD_DAYS(CURRENT_DATE, -1)
You should post your specific attempted usage of it and the error that is reported when you try it.
I'm working with Big Query and I need to get first day of week.
For example if date = '2022-08-26' I want to have '2022-08-22' where 22 is Monday.
Any solutions please ?
Thanks in advance.
To achieve this you'll want to use the DATE_TRUNC function as follows:
select date_trunc(date('2022-08-26'), WEEK(MONDAY))
You can change the parameter for WEEK to be any day of the week, default is SUNDAY.
Documentation can be found here:
https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date_trunc
I'm trying to make a report of daily work for a group of users in a database.
it's filtered by a date range, start date and end date. It then shows a list of the users and a total of things they did during that date range.
My boss wants it to then be expandable to show a breakdown of daily totals.
I can get it to open up and show a breakdown, but it's showing like this example here:
7-1-2018 to 7-2-2018
Jane Doe 5
7/1/2018 1
7/1/2018 1
7/1/2018 1
7/2/2018 1
7/2/2018 1
I've tried to mess with the groups of which there are currenlty only two, the name and the 'dateindexed' which is the entry in the database for when they do what they do. IT has a time stamp on it was well, but need to just have date and total.
I've tried to aggregate it and it then throws an error about no aggregation being allowed when there are filters present in the report.
Any tips or tricks to get this to collapse down on just the date and give a total for the days?
Thank you in advance.
I need Active redshift user count for specific time period (say 20th Apr to 25th May).
I know PG_user table, but know luck with what i am looking for.
All on all i need a report with active user count for specific time period (20th Apr to 25th May).
Thanks a lot in advance.
Do you need to know how many user where logged in that time period?
to get the list day by day
select starttime, process, user_name
from stl_sessions where starttime>='2017-04-20' starttime <'2017-05-26'
to count users in total during that period:
select count(*)
from stl_sessions where starttime>='2017-04-20' starttime <'2017-05-26'
I am fetching results from Google Analytics web api. I am accessing results giving different dimensions like hour, day, week, yearMonth etc dynamically based on the time gap between start-date and end-date.
Here the problem I am facing is with sort-metric parameter. For dimension = day, sort-metric = date works fine but for other dimensions like week, month and year it sorts in ascending order based on the given dimension.
Say for months, I select start-date = june, 2013 and end-date = june, 2014, the results are sorted as jan, 2014;feb, 2014;mar, 2014;apr, 2014;may, 2014;june, 2013;june, 2014;july, 2013;july, 2014....etc
But the desired sort order should be june, 2013;july, 2013...dec, 2013;jan, 2014.....jun, 2014
I need correct sort-metric parameter values for above mentioned dimensions(hour, day, week, yearMonth).
Thanks in advance!
You can use an array in the sort parameter.
In this example you would have to use array('month', 'year')