I am having an issue with the following LINQ query: var baselineDate = DateTime.Now.AddDays(-365); var salesPerformance = _context.SalesOrder.Where(p => p.OrderDate >= baselineDate)….
Query not executing as expected, returns -1 no matter what
I’m working on a user login system for a semester final. I am using C# in Visual Studio with ADO.NET. I have a query that I use on a database table named Credentials: SELECT * FROM Credentials WHERE …
Why can’t I loop through and drop databases?
There is a scenario where I want to go through and remove all databases that have specific text in the database name. It always drops one database and then does nothing. How can I fix this? def …
Find IDs with only one observation in PostgreSQL
I have the following table: CREATE TABLE my_table ( the_visitor_id varchar(5) NOT NULL, the_visitor_visit timestamp NOT NULL, the_visitor_returning text ); INSERT INTO my_table VALUES (‘…
Sumarize colums to get just one value
I get the result shown below, but I need to get only one row with the sum of the column QTD_PARC and VL_TIT, this in the SQl Server, can someone help me please?
Subtotal of child records without COUNT?
ParentSub Table: ParentCode SubCode CompanyName MEGA1 MEGA1 Megacorp MEGA1 SUBC1 Subsidiary Company MEGA1 EASC1 East Coast Operations MEGA1 EURC1 Europe Company BIGLY ALPH1 Alphabet Company …
SQL inner join on column A and compare values in column B
I am sure or maybe hope there is a simple way to do this. Below is my latest attempt. The query should return only one row, but I get 31. Query: `select distinct a.[EC CERS], a.[EC Tank ID], […
Select id from input list NOT present in database
With MySql vers 8.0: CREATE TABLE cnacs(cid VARCHAR(20), PRIMARY KEY(cid)); Then, INSERT INTO cnacs VALUES(‘1’); The first two statements execute successfully. The next statement does not, however. …
I want to select rows which has a particular value in the column but the column can contain multiple values
col_1 col_2 0 ab,bc,cd 1 bc,xy 2 zz,xx 3 ab 4 cc 5 ef,kk,ok I want to select rows that have “ab” as one of the values in col_2. For example – in this …
Group by and display count in Excel
I am trying to learn some Excel’s features and I want to know if it is possible to make an SQL-like statement in Excel. For example, I distincted a dataset and the output is: I want to make a count(*) and a group by like: Answer Initial data: Create a pivot table. When you drag columns like this… …