I have the object Tool with a price and a ToolsOrder for every sale with a quantity. I need to show total of the sales Tool has many: tools_orders ToolsOrders belongs_to: tool I think in something …
Need to generate percentage column in Hive after generating Count from the table
I have created following HIVE table which helps to determine the count and type of individuals from the source hive table. Now I need to create further percentage breakout from this: CREATE TABLE …
Need assistance with IF ELSE condition in Oracle
I have a list of tables, i need to pass those table based on column name. For example if my table has CLASSID it will go block 2, if table has OBJID it will go block 1, if table has KOPPKT it will go …
Using update inside of PL/pgSQL
To begin with, I am a newbie to SQL and PostgreSQL. It might be a silly beginner’s mistake. ^This isn’t working provides me with an error SQL Error [42601]: ERROR: syntax error at or near “update” Where: PL/pgSQL function temporary_function_for_getting(text,bigint,json) line 13 at RETU…
How to search for a month that is input by the user
I am working on some homework and have been stuck on this for a week. I have tried using TO_CHAR, MONTH(search), and EXTRACT(MONTH from…) and they all end up with either identifier ‘JAN'(the month I am searching for) is not declared, or expression is of the wrong type. This assignment is to displa…
How can I do math operations in query SELECT?
I have a table of statistics where operations with water are counted. I have three types of water 0,2,3. But there is water type 0, which includes type 2, type 3 and type 0, that is, water type 0 = 0 + 2 + 3. That is, if an operation with a water type for example 2, then in the
Check if an element is contained in the values (array) of a json column in MySql
I have the following values inside a cell of a json column in MySql: I would like to make a query that extracts data based on the existence of a value in the array at the fornitori key. For now I’ve tried this: Which print is: Basically the condition is that value (“8”) must be inside the …
Selecting single row if it matches another
I have a scenario of this type: I want to select only one row in such a scenario. How can I achieve this? Answer You could use distinct on with least() and greatest(): An alternative is not exists: Finally: if all of the rows are duplicated, then a simple where condition is sufficient:
Write a SQL query to calculate the balance in a card [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Can you please help me how to calculate the balance for each quarter The data table Script to…
How can i find all linked rows by array values in postgres?
i have a table like this: I want to find out which rows are in a group together. In this example 1,2,4 are one group because 1 and 2 have a common element and 2 and 4. 3 and 5 form a group because they have a common element. 6 Has no common elments with anybody else. So it forms