Link to home
Start Free TrialLog in
Avatar of jfergy
jfergy

asked on

Tricky Group by with Sort?

Hello-

I have the following tables:
Personnel
ListingStats
Listings

I need to create a report for my personnel for their listings that gives them a break down of the stats and source count under each. So for example:

Listing 1234
 Google.com  154
 Frontdoor.com  25
Listing 1256
 Google.com 133
 Frontdoor.com 25

The listingStats table can have the source defined from anywhere on the web, so I wont be able to know what that source is, but I need to group by the source as a whole and the count. Your help is greatly apprecited. I have included the table breakdown below and possible query?

Select viewdate, source from tblListingStats where ListingID in(Select ListingID from tblListings where PersonnelID = ListingagentID) Groupby source, viewdate order by ListingID


Avatar of frankytee
frankytee
Flag of Australia image

post all the relevant fields from each table. for eg
which table does PersonnelID and ListingagentID come from?
Avatar of jfergy
jfergy

ASKER

tblListingStats: ID, ListingID, DateTime, Source
TblPersonnel: PersonnelID, FirstName, LastName
tblListings: ListingID, PersonnelID

PersonnelID to tblListings is a 1 to Many relationship
ListingID to tblListingStats is a 1 to many relationship

Thanks for the help!
ASKER CERTIFIED SOLUTION
Avatar of frankytee
frankytee
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfergy

ASKER

Thanks that was awesome!
thanks, you're welcome