I have two tables i’m working with: comporder(quantity,cod(Fk on cod(product),cod_ship); product(cod(Pk),price); I need to produce a query that will give me the sum of the prices of the products that …
Tag: database
MYSQL SUM(IF) with group by NAME but some NAME wanna makes sum
I have one question in SQL. This is the query. it makes a result below: but I wanna make Customer A and B sum together as A(not B) or new name(e.g. Z) like this: I want to modify the query and output it. Answer I understand that you want to group together customers A and B. You can do this
how to convert minutes to days in oracle
How would you convert a number of minutes to number of days? For instance, number of minutes is 20160. Now how do I get number of days based on that using SQL?
query for join two column and get one row per left with column that have array of right table refrenced to left table row
hellow.I have a tablt product like this +——-+——-+ | id | name | +——-+——-+ +——-+——-+ | 1 | shirt | +——-+——-+ color table like below: +——-+——–+ | id …
How do I assign methods to a specific parameter using PIVOT in SQL?
We’re working on producing our data as a relational database/set and as a row-column dataset (so that the users of the data can use which format suits them best). Here’s a simplified table of our data:…
Writing a Single Query w/ Multiple CTE Subqueries SQL/R
I have some data I would like to pull from a database, I’m using RStudio for my query. What I intend to do is write: The first CTE statement to pull all my necessary information. The second CTE statement will add two new columns for two row numbers, which are partitioned by different groups. Two additional columns will be added
SQL query for pagination with multiple columns; understand OR operator
I’m using a tool that generates the Postgresql query below: I need to understand why the OR operator? My players table can have many rows with the same score but not the same id. Is that OR needed when multiple rows has the same score value? Answer The purpose of the OR — as you suspect — is to handle
SQL statement – get 1st minimum then 2nd minimum from join
sorry for terrible description but I have struggled to word this My 2 tables are like this tblParent.. OrderID Customer 789 Bob tblChild OrderID SortOrder Price 789 1 20.00 …
How can I make all values of one identifier the same based a on value in a row?
SELECT a.IDENTIFIER, a.NAME, a.CATEGORY, b.IDENTIFIER_TYPE, b.NAME, CASE WHEN b.IDENTIFIER_TYPE = 111 THEN ‘PRESENT’ ELSE ‘NOT PRESENT’ END AS HAS111 FROM …
Show the names of customers that have accounts SQL Query Oracle 10G
Q1 Show the names of customers that have accounts Q2 Show the customer names with the names of the employees they deal with** Answer Q1 is a simple lookup of the cust_id in junction table has: This phrases as: select the customers that have at least one entry in the has table. When it comes to Q2: your data structures