I do have the table with translated texts to (possibly) many languages. When new text is entered in the chosen language, the lang_hash is calculated. If the text is not bound to any existing text in other languages, the lang_hash is repeated in the key_hash, and–together with the lang code–the new…
Tag: sql
How can I use Except all in SQL Server?
I’m trying to use this query statement in order to except daysoff and a duration, let’s called holiday from a calendar of a specific month . This what I have tried : and this is the function of Get_Calendar_Date To except the daysoff ( weekends ) , I have used except , but what I got is something …
GET last element of array in json column of my Transact SQL table
Thanks for helping. I have my table CONVERSATIONS structured in columns like this : [ ID , JSON_CONTENT ] In the column ID i have a simple id in Varchar In the column JSON_CONTENT i something like this : I would like to query and get the id and the last element of exchanges : [ ID , LAST_ELT_IN_EXCHANGE_IN_JS…
How to create teble 3 from data of table 1 and table 2
t1 (ordered descending): a comment 512 (ordered desc) 415 310 205 195 150 132 90 74 20 1 t2 (ordered ascending): b comment 10 (ordered asc) 11 12 13 I would like to create t3: a (desc) b comment 512 10 (b=asc) 415 11 310 12 205 13 195 13 (b=desc) 150 12 132 11 90 10 74 10 (b=asc)
How can I select data from last 13 months?
I have two tables with exactly same structure Now I need to ‘union all’ these two tables and I want only last 13 month data every time I run below query I have to run this every month and need only last 13 month data. How can I apply the filter? I have a date column ‘date’ in both the
SQL query filter NULL and current month
I have a SQL query and I would like it to list records that: Are in one of these IDProcessState(s): 5, 6 or 7 If IDProcessState is 7, it should only show the ones that were submitted (DtSubmission) this month If IDProcessState is 5 or 6 it should still show the records (they have null DtSubmission column) The…
Invalid Datatype for user defined table type
I have declared the following user defined table type Now when i pass it as parameter to an SP I keep getting the following error Parameter or variable has invalid datatype Answer You must pass this argument as :
XQUERY -SQL Retrieve list of child and parent ID
How I can query the xml in order to obtain the following result? I am completely new on using XQuery. XML sample: And the result: idAsig B1_1 B1_2 B1_3 B1_4 B1_5 1 NULL NULL NULL NULL NULL 2 1 0 N 8 4848 2 52 0 N 8 625 3 1 0 N 8 589 3 39 0 N 8
How can I write a SQL query to calculate the quantity of components sold with their parent assemblies? (Postgres 11/recursive CTE?)
My goal To calculate the sum of components sold as part of their parent assemblies. I’m sure this must be a common use case, but I haven’t yet found documentation that leads to the result I’m looking for. Background I’m running Postgres 11 on CentOS 7. I have some tables like as follow…
Oracle hierarchical queries data
The link gives a good example for overview on how to use Oracle hierarchical queries. I was trying to generate the below combination of data with the example table tab1 given in the link but struck …