I have the following query which gets the sum of defect quantity per Defect Type : SELECT [Defect Type] ,YEAR([Date]) AS YearOfDefect ,SUM([Total Defect Qty]) AS [Sum] FROM SupplierQuality GROUP BY […
Tag: aggregate-functions
Limited By Value Postgresql query
I have a couple of rows where values in one column are repeating and I need to get a couple of rows where every value is limited by const. For example, i have this rows (1, ‘a’) (2, ‘b’) (3, ‘a’) (4,’…
How to choose in postgresql rows where amount of one value is bigger than another? [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question how to choose in postgresql rows where amount of one value is bigger
Query help in SQL
I have the below table, with empid, deptid, and Name. I need to get the results as empid,deptid,name and count of employees in each department. I need to get the results as empid,deptid,name, and count of employees in each department as below. I am able to achieve results using the below queries. Is it possible to do this in alternate
how to get the count of data based on status id in sql
i have following table id statusid 100 1 100 2 100 3 101 1 101 3 i am getting the result like following id data1 data2 data3 100 1 1 1 101 …
Order by with formatted dates, doing it right?
I wanted a mere sanity check because I have a slight feeling I am doing it all wrong. I stripped down the use case to a very simple sample. When formatting a date I need to cast the data in the order …
Group data by foreign key and date with total by date
I need help to select daily payments made and group by the organization and date. Group by date, then the total number of payments and the sum total amount of payments for each day Tables are as …
How to get the average from computed columns in Postgresql?
I have a query: SELECT sum(column_1), sum(…) as sum_1, sum(…) as sum_2, sum(…) as sum_3 FROM table_1 How to get an average data from sum_1, sum_2, sum_3? If I write a query in the next …
How do you populate boolean columns based on a table of properties?
I have a table called Product that contains a product identification number and an id associated with the product identification number. pin id 11 10 12 11 13 12 I also have a property table with the …
aggregating Posts with all their Hashtags using Postgres
I have something like Posts in FB/instagram. When a user searches for something, the input query is used to either find Posts that either have this query in their content, OR – one or more of post’s hashtags match this query. The problem : I can’t figure out how to have Posts returned with a nested array of all its