I am new to C# database and I have been battling with this error for a few hours. When I created the table, I used ctrl + s to save it but it saved like normal saving into My Documents which I think …
Tag: sql-server
SQL Grand Total row from Multi table Select Query
I have been able to use the below SQL query to give me 4 rows of data SELECT ‘Sales Order ‘ as Type, Format(Sum(T1.C_NetAmountLessDiscount), ‘#.00’) As NetAmount, Format(Sum(T1.C_MarginAmount), ‘#….
Most performant way to filter on multiple values in multiple columns?
I have an application where the user can retrieve a list. The user is allowed to add certain filters. For example: Articles: 123, 456, 789 CustomerGroups: 1, 2, 3, 4, 5 Customers: null ArticleGroups: null … When a filter is empty (or null), the query must ignore that filter. What is the most performant …
SQL Server – Delete rows from one side of a JOIN
I have a query that identifies orphaned rows in one table after joining it to another. The query I have for selecting the rows that need to be deleted works fine, and properly selects the rows that …
Trying to get Price Difference and Percent Difference
I am trying to find the daily price difference and the daily percent difference, in one field, in one table. Here is the code that I am testing. Here is a sample of my data (first three fields), with the expected results (last two fields named ‘PriceDiff’ & ‘PercentDiff’). I am usi…
SQL query for subtracting values from columns and add it to same row
As you can see, the Menge column is decreasing its value for every row, subtracting the Reserviert value from the previous row. Can anybody suggest how to write this type of query in SQL Server? Answer It Cannot be Done by SQL Only . It must to be done by Code
SQL – Getting duplicate list based on value from multiple column
First, sorry if the title is misleading, so i make this example. Table : data_list Column : Serial, A1, A2, A3, A4, A5 Datas : 381, 0, 0, 0, 125, 99 537, 10002, 1234, 0, 0, 0 931, 0, 0, 0, 0, 0 1213, 123, 100, 0, 0, 10002 1437, 7361, 918, 17823, 0, 0 7777, 0, 0, 100, 0,
sql Query support required for condition
I have a query if vatgroup chooses x6 or x7 in output has to show ‘-‘ other than than it has to show the value what is come. Based on below query my output comes as * for other than x6 or x7. Thanks Vinoth Answer You are casting your integer sum to varchar(1) which means if the sum is
How to Find Unique Rows without GroupBy, Distinct
I have a SQL field that I only want to appear in a field in my sql query results depending on the value of FamilyType. So when the Family Type is 3B then I want FamilyID to appear. I do not want to have duplicate rows (without using distinct or group by or where clause = 3B). These are my
How to merge rows into one row with separator
I need merge rows into one row for summary of calculation (SQL Server 2014). My SQL query is: Result of this query is: I would like to have this result: When add new currency (x), the result of new currency must be appended: Can somebody please help me with this topic? Many thanks Answer Something like this s…