There is an SQL query forming a table. It is necessary to form another double-number field based on one of the string fields in the table. Values of the original string field (BRLOADSTA0): Values of the resulting double-field (BRLOADSTA9): The request which I’ve create: Full snippet: Thanks in advance even for trying to help 🙂 Answer Could you tell us
Tag: database
MySql format number with space as thousand delimiter and no decimal zeros
Having the number: 103,648.340 format it to be as the expected result Expect result: 103 648.34 My progress: TRIM remove decimal zeros, so I’ve 103,648.34 FORMAT add thousand delimited by space, so I’ve 103 648.340 I’ve tried to combine TRIM with FORMAT without success Answer Try this solution: DEMO
Update query with join and where clause
I’m currently confused with a (fairly easy) update statement that I’m trying to execute on a table. The two tables are as such: Customer table has the columns Loan table has the columns I would like to update the passworddisabled attribute to true if they are registered via a specific cash register. I’ve made use of the distinct command because
Simplifying SQL query
I’m using the Bixi public dataset found at https://www.bixi.com/en/open-data and have been asked to find “the average number of trips a day for each year-month combination in the dataset”. Here’s an example of the table from which I’m querying: id start_date start_station_code end_date end_station_code duration_sec is_member 85843 2016-04-15 00:00:00 6315 2016-04-15 00:05:00 6315 349 1 85844 2016-04-15 17:16:00 6315 2016-04-15
Sybase select value from XML field
I have a table named data_values stored in SYBASE in the following format: The value field has the following XML format: I want to select from the value field values like value1, value2, etc. but I can’t find a correct query to do this. I have tried: also value is a reserved keyword I think and I need to escape
Error Code: 1242. Subquery returns more than 1 row in Attribute Subquery
I’m trying to get the difference between two dates deathtime and admittime using subquery in attribute list. This is the script that I run: It returns Error Code: 1242. Subquery returns more than 1 row when I run it. Would really appreciate any help. Answer The reason why you’re getting that error is because a subquery can’t return more than
Is there a way to calculate difference whthin a specific time range using clickhouse MV?
For example, this is my source table What I want to do is to create a MV which asynchronously calculate the price difference whthin 30 min. And then, I can get the difference from this MV using an id every time. Here is an SQL example. It works correctly while directly execute it, but does not work while creating a
SQL Trigger for updating values from a query by id
I have three tables: employee with id(employee id), numOfTickets tickets with date, asset(id) and some more fields control with id(employee id), asset(id) when a new ticket is created it automatically inserts a row into tickets and control. Now I want to create a Trigger or something similar to automatically update the number of open tickets for each employee. A Query
How to filter inconsistent records in sqlite
Say I have SQLite table with the following records: recID productID productName 1 1 Product A 2 2 Product B 3 2 Product C 4 3 Product D 5 3 Product D recID = primary key, auto increment. If I run: Result is: productID productName 1 Product A 2 Product B 2 Product C 3 Product D As you can
SQL – Expand column of arrays into column of elements
I have a SQL table, and one column of the table has type text[]. I want to create write a query that will create a new table, which consists of all arrays flattened and concatenated. Ex: If there are 3 items in the table, and the array entry for each of those items is [1, 2, 3], NULL, [1, 4,