Skip to content

Tag: join

Data Joining of two Tables MS Access SQL

I have two tables named – 1) Students 2) Classes. ClassID is Primary Key of Classes table and Foreign Key of Students Table. I want to access one row from the Students table having specfic RollNo (This RollNo is given by user input) and all rows from Classes Table. Students Table is given as:- RollNo is…

SQL Server INNER JOIN and GROUP BY

In sql server I’m trying to group by each sales people some infos as follow: I have 2 tables: Positions and Clients In Positions table, I have the following columns: Client_Id, Balance, Acquisition_Cost and in the Clients table I use the following columns: Client_Id and Sales_person. I want to group by …

Combining MySQL Queries to get total amount

I’m trying to combine the following 2 queries. table_A stores a list of available appointments and number_open is how many open slots there are for a specific appointment, in this case 2020-06-30 AM which has 5 open. table_B contains any dates waiting to be accepted and has a different record for each d…

Compare two values in a row

select event_slots.id as event_slot_id, u.first_name, u.id AS user_id, sum(case when next_round = 1 then 1 else 0 end) AS yes, sum(case when next_round = 2 then 1 else 0 end) AS no from event_slots …