I want sum of price in my table depended by ‘CorpCode’ from other table where ‘InvoiceDate’ between last week from Max(InvoiceDate)LastInvoiceDate My table design is: T1: CorpCode AuthorNo …
Tag: sql
How to count the Gap between dates in SQL Server with overlapping dates
I’m trying to get the GAP (In days) between records in one Table, I’m using SQL Server. So far, I was able to get the gap (in days) between dates, but there was an issue with the overlapping dates. …
How to display number of employees of each position in each department
I have two tables, named Employee and Department. Employee (Emp_ID, Name, Position, DeptID) Department (Department_ID, Dept_Name). The position of an employee may be tech_support, data_entry, or …
Sql Server Float to C# double adding trailing zeros
I have a float column in SQL Server with value 21.261 , when I am fetching this column into c# double , using entity framework core 2.0 it is becoming 21.2610000000042, how to avoid this and get the …
More than 24 hours in a day in postgreSQL
Assuming I have this schema: create table rental ( id integer, rental_date timestamp, customer_id smallint, return_date timestamp, ); Running this query returns strange …
Already inserted data replace into another UserId
In my Business unit table FK is the UserId ex: UserId =001, BusinessUnit = Bangalore ex: UserId =001, BusinessUnit = Hyd …. Now, I need UserId = 002 is different I want to create same data into 002 The INSERT statement conflicted with the FOREIGN KEY constraint “FK_UserAccess_UserDetails”. T…
SQL Function inside of where clause to see if field is in concatenated list (from parameter)
I have these two lines ,SUM (CASE WHEN (DATEDIFF(DAY,Shopify_Ordered,Confirmed) >= 1)THEN 1 ELSE 0 END) OVER () Orders1DayNotShipped ,dbo.GROUP_CONCAT( (CASE WHEN (DATEDIFF(DAY,Shopify_Ordered,…
How to execute a native SQL query having INTERVAL clause through Spring Boot JPA?
Not able to execute a native SQL query through Spring Boot Repository layer with JPA in Oracle DB I am trying to write a native SQL query that gets data from a table between the current date and last …
How to write Inline If Statement(SQL IIF) in EFCore Select?
I have the following Customer table: Id First Last LocationId 0 John Doe 2 1 Mary Smith 4 My use case requires column level permissions(predicated on a value in the Entity’s …
SELECT Records From Child Table That Are Not In Another And Parent Has No Other Children
I’m trying to write a query to select all orphan records that are in a child table, but only when orphaned records are the only items in the table. I have two separate databases from separate systems,…