After asking about calculate the sum of the total price here and Its work but then went I add(SUM(PRICE*AMOUNT) AS TOTAL_PRICE) to create my own View, the Total_price = Expr1, It just PRICE * AMOUNT, there is no sum here. I apply It to create a view here is the query Here is the output Could anyone help me ou…
Tag: sql-server
Best practice for verifying correctness of data in MS SQL
We have multiple tables with different data (for example masses, heights, widths, …) that needs to be verified by employees. To keep track of already verified data, we are thinking about designing a following table: This table links the different product id’s, tables and columns that will be verif…
Date conversion in SQL from 10-09-2020 to 2020-09-10
I want to convert it for comparing data & here I am stuck. I have data in date column like 10-09-2020 where convert(varchar, date, 111) >= ‘2020-09-10’ AND convert(varchar, date, 111)
SQL – Compare 2 tables and show non existent data
Ok, I have 2 tables that I need to do a comparison to. The idea is to show anyone in the database who has not purchased a specific product. Table 1 UserID Customer ProductsSold 1 John Cookies 2 …
SQL connection string is not recognised and throws and exception in C#
CONTEXT: I am writing a WPF app. It works with a SQL Server database in which I put some data, concretely the strings Titulo and Descripcion, the int XP and the string fotoMision. When I click a …
How to SELECT from column WHERE we have multiple conditions in from another TABLE?
I have 3 TABLES: movies which has title and id columns stars which has person_id and movie_id columns people which has id and name columns I want to write a SQL query to list the titles of all …
Retrieve Specific Text from String where Search String Exists and Not Exists
I’ve got the following code. It returns the correct result for the first two test strings, where it should return the text between the two ****. The 3rd string returns ” abcd two two ****” …
SET parameters to microsoft SQL server to set environment
I have created some microsoft SQL server queries to insert values into some of my tables created. Below are the sql queries i used. Above is a piece of code which i have used for dev environment. Same code with prod instead of dev should be used for production. Is there any way to parameterize dev and prod to…
LEFT JOIN but take only one row from right side
Context: I have two tables: ks__dokument and ks_pz. It’s one-to-many relation where records from ks__dokument may have multiple records assigned from ks_pz. Goal: I want to show every row from …
How to map/join two tables and filter by parameters using dapper
I want to join two tables that have a relationship with each other, In the Customer table, there are two columns for deleted and approved. Get the Customer that are approved and not deleted then match the Customer with the Loan table Using CustId (Both Tables has CustId) and Filter by supplied parameters Dele…