I have 2 tables Booked Books I’m currently working on this query but the result is not correct. Output The result that i want is Can you help me to fix it? Thanks. Sorry for my bad english Answer Your question lacks the clarity but to my instinct of what you have posted may be this will work, as far
Match duplicate value from the second column based on duplicate value from first colum
I have table like this I have two condition for this table which is : Val column must be duplicate value AND, Val2 column must be duplicate so my goal is return data if the two condition meet. If the column val had duplicate value and column val2 had duplicate value and each column on his own row. my query
Not able to display Chinese character in application
I have a column in which Chinese characters are stored and the column contains a customer name in Chinese language. When I select the column in SSMS I can see all the names in Chinese language but when the same is done from application the application displays ‘??????’ in all the fields of that co…
How to read JSON value in MySQL
The JSON output I need to insert into my database but my source code throws an error: The source code: Can anyone help me with this, as I need to get values for open, close, high and low. error: Answer you have 5 columns, hence 5 bind variables. Your insert template is over complicated with any database opera…
SQL – Find total number of orders made for each customer
I have 2 tables customer and orders. Each customer can place multiple orders customer has a column customer_num orders has columns order_num, customer_num I want the results to show like this: Here is my current code which only returns all the distinct customer num Answer Try the below – using count() a…
How to remove redundancy when a lot of columns can have repeating data?
I am working on a library system. I have a book table in which there are 12 columns including author, title, publication etc. Among those 12 there are 2 columns book_id and isbn that are unique. When a library get n copies of a same book the only columns that are going to be unique are book_id and isbn. All
List Customer And Product Without Sale
Need to show the following columns (3) using UNION to return: All customers who do not have an invoice All products that were not sold Category: Is this related to “customer” or “product”? Print “customer or “product” ID: Customer.id (category=”customer”) …
Altering Oracle Sequence with result of two subqueries
I am trying to alter a sequence with the result of two subqueries. I am new with Oracle and stuck with a syntax. If you can, please help me with this : Upon Executing this, I am getting an “invalid number” error. What am I missing here? Answer You’ll definitely want PL/SQL and dynamic SQL, b…
Apply limit to CASE statement
I am trying to collect counts of different columns for players (you don’t need to know the ins and outs of all the columns). We have a player_1 and player_2 column so I have made it distinct to get total counts, as you can see below: I want to also get the frequency of goals for last 32 games for
Monitor the activity of a table (number of select on a specific row)
I have a large dataset Table: id | info1 | info2 | … There are multiples process accessing the data heavily. Is there a built-in way in postgresql or an extension to know the number of time a row is accessed with SELECT ? I was thinking of making a stored procedure and manually manage it. Answer No, the…