Skip to content
Advertisement

Order and limit data based on JSONB array

I have such a PostgreSQL table Now I would like to get all sorted val and have the limitation for each query (for pagination). For example 1st query 2nd query Answer You need to unnest the array, sort the result then apply offset and limit: Instead of limit 5 you can also use the standard compliant fetch first 5 rows

Parse text and special characters from SQL Server

I have an issue with parsing text with special characters from XML in SQL Server. Let’s say I have a XML file Sample.xml which has the following data: I prepared the following SQL script which can parse everything except two sentences in the <TextType> attribute: First sentence to retrieve Second sentence to retrieve Could you please help me to add

Production amount each year by ID and Date

I would like to get yearly production growth amount based on ID and DateTime. In the above example, for the ID – 1, it is showing perfect (705+326=1031). But for the ID – 104, it is not showing right answer like (10+54=64). where is the wrong in my SQL query below to get the annual production growth amount by Date

SQL divide count grouped by the same value from different columns

So I have a table with two rows containing names and some other stuff, these two columns can contain the same name: Buyer Seller RegionID … John Lina 1 Lina Kajsa 2 John Conny 5 Kajsa Conny 3 John Erik 2 Kajsa Conny 1 John Conny 2 John John 1 John Conny 1 Kajsa David 1 David David 1 Lets

ORACLE CONVERT CHAR FORMAT “YYYY-WW” TO DATE FORMAT

I am trying to convert char date format “YYYY-WW” in ORACLE to date for calculating by week in year but have a trouble with error message format code cannot appear in date input format If i write It will be normal But if i write The message error format code cannot appear in date input format appear. I don’t have

Advertisement