Skip to content
Advertisement

Tag: sql-server

Exclude blank column while Joining two SQL server tables

I have set of vehicle parts stored in two tables as per below: Source Table1: Vehicle_ID Part1 Part2 Part3 Part4 Part5 1 10 20 30 2 10 20 3 10 Source Table2: Vehicle_ID Part6 Part7 Part8 Part9 Part10 1 40 2 30 50 60 3 30 Required Table like below: Vehicle_ID Part1 Part2 Part3 Part4 Part5 1 10 20 30

Assistance with PERCENTILE_CONT function and GROUP By error

All, I am having problems with the below query. I am trying to get stat data from our database for the last 3 years but I keep getting the error message: ***Column ‘OC_VDATA.DATA1’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.*** I know it has something to

Return distinct results that appear more than once

I have the following data: Result should be: Note that the result find unique combinations of ID and Site that repeat more than once for a given ID. I did the following query but does not return the result: Answer See: DBFIDDLE The SELECT ID, site FROM table1 GROUP BY ID, site will select the distinct values. Then, using HAVING

query to get statistic data from SQL server

I have a table named total sales. In this table there are sales data like invoice date and branch name that sells the invoice and the quantity. I am trying to make a query to get total sales for each branch in every single date and my code is below, but when I execute the code the query returns an

Advertisement