Skip to content
Advertisement

Tag: sql

Sum value is too big when adding a another table ORACLE SQL

When I want to sum two values from two different tables – the tickets sold out on match and the TV transmission i got too big sum value in result. I figured out that for single match transmission cost is X times too big, where X is a number of tickets for this match, only when I join a tickets

Performing a query on a foreign table but returning only the original table?

Let’s say I have a Item and Person table, where the Person ‘id’ column matches the Item ‘person_id’ column. I want to retrieve records in the Item table where the owner (Person) of the Item has ‘category’ 1. Sample structure below: Item id item_name person_id Person id name category (can be 1, 2, or 3) I understand that I can

Why is it not updating

I’m trying to update my database where in the Book copies will be updated to 5 depending on the Book code. The Book copies I initialize in the database was 10. For now, I have a fixed value of 5 to change it. My plan is to decrement the copies by 1 if users borrowed it. But for now, I’m

Compare two results in MySQL [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I want to get an average of Customers total purchase and store it in @x Then I want to store

Postgres Nested JSONB Query

I have a JSONB column, data, in the orders table: I’m trying to select “orders where discount_codes contain a code in codes_array”. I could not figure out how to write this query exactly. I read about the [*] operator but am unsure how to use it in this context. This only searches the first element of discount_codes: This only searches

SQL: how to copy value of meta_key inside array in another meta_key?

I’m asking here since seems more like a SQL question than WordPress. I have a WordPress installation using custom fields from a template and custom fields from a plugin (ACF). There are thousands of posts using the custom field from ACF, “subtitle”. Now I need to move all “subtitle” values to the other custom field, “td_subtitle”. I found a simple

Assignation counting up to maximum

I have the below 2 tables: aux1: PC A MAXI PC1 A1 1 PC1 A2 2 PC2 A1 1 PC2 A2 2 aux: VK D PC VK1 8 PC1 VK2 7 PC1 VK3 6 PC2 VK4 5 PC2 VK5 4 PC1 VK6 3 PC1 VK7 2 PC2 VK8 1 PC2 I would like to obtain the following output: VK D

Advertisement