So I have a database and I have 4 tables (admin, appointment, doctor, patient). I only care about appointment, doctor and patient. Diagram of these 3 tables: What I want is based on a patients amka(int) to find all his appointments and show his name, surname and doctors name, surname. I made this query: The p…
Display individual elements from grouped rows on same row
I want to both group some rows together but return 1 column of the individual rows from the group onto the same line as well, probably easiest to show with an example…. Original Data Grouped by rDate, track, AVG(odds) Desired output, grouped with average odds but with individual odds added to grouped ro…
SQL Comparison Operator Issue) …right syntax to use near ‘>’2021-06-01’ AND 100*(d1_close-close)/close>’29” at line 1″)
I’m trying to run a SQL query through python file, and I’m getting the error message My query code is as below: I have also tried different versions like below: UPDATE)) I think the syntax error is in the comparison operator. How can I send comparison operator from python to SQL? Answer Triple quo…
SQL – How to find if the combination of column has occured before or not?
Following example demonstrates the question id location dt 1 India 2020-01-01 2 Usa 2020-02-01 1 Usa 2020-03-01 3 China 2020-04-01 1 India 2020-05-01 2 France 2020-06-01 1 India 2020-07-01 2 Usa 2020-08-01 This table is sorted by date. I want to create another column, which would tell if the id has been to th…
How to get JSONB array index
I’m sure there’s a simple answer to this but I just can’t find it. I need to obtain JSON array elements as rows, but their index is relevant for the subsequent processing. Here’s a [very simplified] example: I need to get: I’ve tried: But the section column is not computed correc…
Can’t found the poroblem within this Hive Query [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed las…
SQL how to exclude rows only if two conditions are met
How do you write a where clause to exclude rows only if two things are true? For instance, I want the inverse of SELECT * FROM table where start_num = end_num and time_taken < 100 So I only want …
How to update tables in MS ACCESS with query or with VBA & SQL
I have made my database work with all kinds of codes and workarounds, but it is not efficient! So here is a question that would solve a lot of my problems: Two ACCESS tables: Tab01 & Tab02. Both …
MySQL column to show the sum of column in another table
I have two tables in SQL both hold the ID of users. Table Accounts Table Transactions The table accounts column points should have the sum of that ID in table transactions. So in table one, the output should be points of ID 1 to be 5 and id 2 to be 20. I am new to MySQL so if you
How to execute multiple joins with different params in a single query
I have two tables, question(question_id) and question_exclusion(question_type, question_sub_type, question_id) I’m able to do it If I specify question_type and question_sub_type. SELECT * FROM …