Skip to content
Advertisement

Tag: lateral-join

Insert 2 select in same insert SQL

i have a problem, i would like use 2 select to insert in new table but i don’t know if it’s possible… my code : I would like insert the second part ( select COLONNE01….) in the first part instead of “INSERT HERE” DATA OLD TABLE : COLUMNS 1 (“PKID1″, one”,”two”,”three”) COLUMNS 2 (“PKID2″,”one”,”two”, “three”) New TABLE : (PKID1, one,

How to include OPENJSON in View?

My JSON object is stored in the table (single cell). Right now, I’m reading the cell and saving the value to @json NVARCHAR(MAX) , but that obviously doesn’t work in views. How can I do something like this? Answer You can use cross apply to apply openjson() to each and every row of your table:

logic to create more rows in sql

I have a table1 that I wanted to transform into the expected table. Expected table logic for columns: cal: comes from cal of table1. ID comes from the ID of table1. code: this is populated with lp or fp depending upon if we have a value in f_a then we create a new record with fp as code. corresponding to

PostgreSQL parse countries in array against the countries table

We have content and country tables. Country is pretty simple: country_name column defined as string: Albania, Belgium, China, Denmark etc… Content is a table with half a million of rows with various data with countries column defined as array text[]. Each value there has a number of countries concatenated like: {“denmark,finland,france,germany,ireland,gb,italy,netherlands,poland,russia,spain,sweden,australia,brazil,canada,china,india,indonesia,japan,malaysia,vietnam,mexico,”south korea”,thailand,usa,singapore,uae”} The update from internal team is for a

Can PostgreSQL JOIN on jsonb array objects?

I am considering switching to PostgreSQL, because of the JSON support. However, I am wondering, if the following would be possible with a single query: Let’s say there are two tables: Table 1) organisations: Table 2) users: Now I want to get a result like this (all i have is the ID of the organisation [1]): I know this is

Advertisement