I do have the following issue: Let’s say you have a table that looks like this: Question: I want to have an query which will deliver all the NotPrimID’s which do have the Number as 13, however if the Number of a NotPrimID is also 14 etc. it should be automatically excluded from the list. Answer Yo…
Covert Access Cross tab to sql
I need this converted to a SQL view. This is the code from MS Access: Any ideas how to re write this into SQL ? In products I have id, BelsCategoryID. In Categories, I have ID. In Sold, I have BelsProductID and year. – This table shows weather a product is sold in a given year. I want the result
recursively creating multiple rows for every date between two dates in one row
I have staff holidays (rdos) stored in a single row, I am very close to recursively expanding them to show a full row for each day of leave. Running this on Postgres Database version 10.10 Data Set: My query currently: I am getting duplicate regressions and unwanted cross matches. Any ideas? I have seen simil…
When selecting data with DATE_FORMAT() is not getting proper values MySQL
I’m having a table structure as below. insert statements : when i select with below query I’m not getting the proper out. Output : I need a data where dt values are less than 90 Days. Can anyone suggest where to make changes. Answer You are overcomplicating things here I think. Basically you are t…
Order by column having duplicates for aggregation
Employees Table Question: Why does ordering by a column having duplicates produce final values instead of intermediate values? For e.g. when this query is executed, 3 employees having salary = 5000, the final value i.e. the value that should be produced for the 3rd employee is produced for the 1st? Answer SQL…
Create Table variable datatype that would allow to save integer/floats [SQL]
as the title states, when creating a table, when definining an variable + datatype like: Question: You can define a variable as integer or as float etc. however, is there a datatype that can hold both values, integer as well as a float number ? Answer Some databases support variant data types that can have an…
TSQL Two different tables, 800GB vs 2GB Find common
I have two tables, generatedblock table, and addresses table The generatedblock table has a column called expandedblock block. The addresses table has a column called address. What I need to do is find if in the generatedblock table there is a value in the addresses table. I have tried failed code but I am no…
Custom sorting in oracle
I am trying to sort a particular column “TENOR” on the basis on maturity (group by Currencies) for eg – it should be sorted in the following order ON, SW, 1M, 2M, 3M, 6M, 9M, 1Y, 18M, 2Y and so on.. where ON = Overnight, SW = Single week and 1M = 1 month. i have tried using order by
Is there a way to convert this query into Oracle query using merge statement?
Answer I think this does what you expect. Without table structures and sample input data it is not possible for me to test it.
Check if weak entity contains a specific value in its list of records
So what I’m trying to do is to check whether in a list of id_1’s, does it contains a specific value in its list? e.g. Does id_1 of 1 contain a val of 10? Both the id_1 and val columns are foreign keys….