Displaying some data using free version of grafana. The string that has to be displayed looks like this: 5555.7777, but I only want to display 5555. Are there any functions to remove .7777 in SQL or grafana, so that the value that will be displayed only looks like this: 5555. Thanks in advance. Answer You sho…
Tag: mysql
GROUP CONCAT and LEFT OUTER JOIN to split
I’m working with SQL Workbench. This is an example of the tables I have: I have not created this DB and can’t modify it. Each building corresponds to a site, so it contains a KEY to such site. Same with levels and buildings. I am trying to get this result the first two columns are easy, but I̵…
how to group the data by some interval datetimes?
there are many devices and while using it will upload data every some seconds or minutes. I want to get the sections of date-time that the device is in use can it be true that group the data by an interval? let us consider interval = 1 minutes then group the data which the minus of the two date-time is
MySQL table update after multi field check
Hi I have two table one like this one: table1 and one like this: table2 I would like to update all the fields on the table2 column “newID” based on this rules: if (table2.ID = table1.ID_actual or table2.ID=table1.ID_old) then table2.newID = table1.newID How can I resolve this problem ? Answer You …
MySQL Trigger Nested Group_Concat Duplicates
I have a trigger to conditionally GROUP_CONCAT a few columns. I can remove duplicates from within a single column, but I’m struggling to remove duplicates between two or more columns. Current trigger (two column example): Fiddle: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=46a6bb915fa7e2e9106b073677eee6cd…
mySQL update average amount of last 5 dates when there is gap in dates
I have mySQL table like below, Is there any way I could update the value in table2 to where ? is placed. need the last 5 Days Average Amount when the sales actually registered, from last 5 dates from table-1 for(9th, 7th, 3rd, 30th, 28th) Answer here is one way: to update :
MySQL – Query and group in a single row
I have a set of data as below: EmployeeId Salary_Basic Salary_Transport Year E001 12000 3000 2018 E002 9000 2000 2018 E001 13000 3200 2019 E002 10000 2400 2019 E003 15000 5000 2019 What I want is below: EmployeeID NetSalary_Year2018 NetSalary_Year2019 E001 15000 16200 E002 11000 12400 E003 0 20000 Can anyone …
Sequelize – is it possible to limit the number of record in junction table
There are 3 tables student_teacher, student, teacher with below relationship. Each teacher will be responsible for 5 students, so the relationship should be 1 to Many, but I decide to create a junction table for storing extra information for this relationship. When I create a student_teacher record, the paylo…
PHP MySQL loop through the rows and print date when the date changes
My messages table is like this: This is my query used for fetching messages: I want to use created_at timestamp field to group messages in such a way so that I can display date when the message transactions took place. For example: I therefore want to print a new header containing date each time the date chan…
Mysql query : how to calculate statistic growth rate between two period per category
From this table of dates and categories inputs : I’d like to get these folowing table, showing number of rows per category for each first and second quarter, and the growth of number of rows between second and first quarter, in value, and in percentage – which is a simple statistic table type that…