I have a column with values like the one below. I need to separate value number 10 from each row in SQL sever (being value 1 the first one in the string, second after the first comma and so on). …
Tag: sql-server
How to handle aggregate function in Case statements when it involves date columns
I’m calculating invoiceDate vs currentDate then sum Value/Amount column grouping by Customer but its returning “invoiceDate is not contained in either an aggregate function or the GROUP BY clause” …
Convert SQL query to Entity Framework which used AggregateFunctions and Where clause
How can I convert this query to Entity Framework? SQL query: SELECT Fullname, SUM(CoinCount+DiamondCount) AS GeneralPoint FROM Students, Groups WHERE Students.GroupId = Groups.Id AND Groups.Name = ‘…
How to select last one week data from last date
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 …
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 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,…
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,…
Extracting Data from SQL Server Table within a Schema
I am having a hard time writing and extracting data from SQL Server in RStudio. My database hierarchy is as follows: LDS LDS HIG table_needed I’ve tried: ch <- DBI::dbConnect(odbc::odbc(), "…
How do I select birthdays in the next 30 Days
I have a table with birthdates and I want to select all the birthdays that will come in the next 30 days. The situation is, that all the birthdays are written in the form off 1999-09-15 which means that even if I tried selecting the next 30 days, the birthdays wouldn’t show up because the year is 1999. …