I have a column type CLOB that stores an array of objects containing the following structure: {“id”: number, “name”: string} Then suppose we have the following column of CLOB records: [{“id”: 21, “nombre”: “fisica”}, {“id”: 16, “nombre”: “auditiva”}] [{“id”: 16, “nombre”: “auditiva”}] [{“id”: 4, “nombre”: “intelectual”}, {“id”: 21, “nombre”: “fisica”}] and so several records that its array in the CLOB
Tag: sorting
Reverse EBCDIC sorts numbers before letters in ROW_NUMBER function
So I do have following SQL select Key is of the type VARCHAR(12). I wonder why the hell the numbers are sorted after the letters. Every other system including UTF-8 always begins with numbers. Answer So a solution you can do is to take advantage of the EBCDIC character order. Special characters are sorted before the letters! If the numeric
Error when SQL Server grand total comes out on first row instead of at table end
The following query gets row and column totals. When I add ORDER BY, the column total appears in the first row instead of the bottom row. What could be your suggested solution? Answer you can use grouping which returns 1 if the column is part of aggregation and you can use it in your order by:
Oracle SQL – Custom Sort
I have a scenario where I have following data: Table: Locations I want to sort in a way that all the IDs that end in ‘0000’ should be sorted first, then the TYPE ‘Warehouse’ and then the rest of the Stores. The desired output should be like How do I do this custom sorting? Answer This is how I understood
Sort records with an associated field
I want to order records with associated records in GORM V2. I have two structs: type Client struct { gorm.Model UUID uuid.UUID `gorm:”type:uuid”` ClientProfile …
SQL Tree Query – WITH RECURSIVE & UNION. How to sort by a second value
I have a category table with a tree like structure (see image below). For a fast single query, I have the following SQL to get the full tree. This query result in the following table So the ordering according to path works well. But what I require is to have the order according to the column position, if the path-level
PostgreSQL: Make data appear in different rows instead of same row
I have this query: SELECT SUM(CASE WHEN color = ‘blue’ THEN 1 ELSE 0 END) AS “Blue”, SUM(CASE WHEN color = ‘purple’ THEN 1 ELSE 0 END) AS “Purple”, SUM(CASE WHEN color = ‘yellow’ THEN 1 …
SQL query for pagination with multiple columns; understand OR operator
I’m using a tool that generates the Postgresql query below: I need to understand why the OR operator? My players table can have many rows with the same score but not the same id. Is that OR needed when multiple rows has the same score value? Answer The purpose of the OR — as you suspect — is to handle
Sort by Name first then number in sql query from a delimited string
We have designed to register customer’s station-division records in 1 field. So the table rows looks like this. create table test4 (f2 varchar(100)) insert into test4 (f2) values (‘A08-0100’) insert …
SQL: ORDER BY using a substring within a specific column… possible?
I have a database whose columns are npID, title, URL, and issue. Here is an example of two years’ entries: What I would like to do is be able to sort the results based on substrings within the “issue” column. However, until 2010, the client used seasons as the header and in 2010, they started using quarters. Is there a