Skip to content

Selecting Highest rows

Please help me with below data. How should I query it. Name Speed Tier Usage Andrew 200 5000 Andrew 100 2000 Luis 100 1000 I need to …

Rows Getting duplicated while doing summation

I have 3 tables. The join between first two tables in CONTR_ID and between second and third table is ENC_RCPT_ID. CONTR +—-+———-+——+———–+ | ID | CONTR_ID | CURR | TOT_CONTR | +—-…

PHP Recursive Function pass by reference

I am trying to 27 display random images on my website and for that I’ve stored the image source in my database. $query = “SELECT imgURL from my_db;”; $stmt = $con -> prepare($query); $…

Can a MySQL event delete multiple rows instantly?

Well i am doing my diploma thesis and i had an idea in mind for the database of the program i am designing. I am doing a Gym Membership Manager and i the main purpose is to keep records of the clients …

Fetching Database Name with Space

Thanks for looking into my post. I am trying to run a query across all the database in SQL Server but the cursor is not fetching if the database contains space and the database is online. Code Error Answer Delimit Identify your object’s name. In normal terms that would be wrapping it with brackets ([]),…

AVG() of the quotient of two fields giving unexpected output in SQL

I have a SQL table and I need to find the average of the quotient of two fields (rating, position) grouped by another field (query_name). I cannot make sense of why the following two queries don’t give the same result: Query 1: Query 2: Here is the table: This is the expected output: However, Query 1 gi…

Top 3 Values in the Same Row

I am working on Steam data and need to find the top 3 tags people used for each game but the problem is all the tag values are in the same row for each game like the image below (appid column then 370 column for each tag and values). Result can be anything like 200,300,400 or column name plus tag

SQL: finding duplicates that do not have a success message

I am struggling to return all batch_id’s that do not contain a corresponding “PASS” From the above table, i need an sql statement that only returns batch_id 104 because it never had a status of “PASS” The database is an oracle DB, therefore if its is not possible with a simple se…