Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Need to write a SQL query

$
0
0

Below is the ERD.


In need to create Report in following structure.


The contact in above report will be the contact linked to the activity table where contact_Id=dbo.Contacts.Id

CreatedBy is the Agent in above report which can be found on dbo.employees where UserAccount_Id=CreatedBy

In row4 and row 5, there are 2 contacts from the company Company3. This will be the 2 activity records with same information except a diff contactId. Same time, same company Id,same day and date.

In row7,8,9, there are 2 companies. In this there are 3 activity records with same date, time, Id

What SQL query I should write.

Need Help..

Thanks


Abhinav




Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>