Skip to content

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 …

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…

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

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 …