Skip to content

Tag: inner-join

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 …

How to calculate aggregate on inner join

I have two tables, Post & Comment. Post table contains info about posts & comment table contains the comments data about each post. Below is there structure, I need to take post_id, post_title from post table and total no of comments (using aggregate function count) on each post from comment table &am…

Order of tables in INNER JOIN

Going through a book, Learning SQL by Alan Beaulieu. On topic of inner joins, it tells that whatever be the order of tables in a INNER JOIN, results are same and gives reason as follows: If you are confused about why all three versions of the account/employee/customer query yield the same results, keep in min…