Hello,I want to select some users of Users table and count the offers published in Offers table by every selected user for a specified date, the selected users that hasn’ t got offers published for that date show 0 (zero). I want this kind of selection to insert into another table the specified date, the user number, number of offers published that date, and other data. How can I do it?I tried:USE database_4GODeclare @Date As smalldatetimeSET @Date = DATEADD(dd, 0, DATEDIFF(dd, 1, getdate())) --Yesterday date, without time SELECT @Date As 'Date', u.User_id As 'User_Id', COUNT(DISTINCT offe.Offer_id) As Offers, ‘Other Data’, ‘Other Data’,..FROM Users As uLEFT JOIN Offers As offeOn u.User_id = offe.User_numWHERE DATEADD(dd, 0, DATEDIFF(dd, 0, offe.Date)) = @Date And offe.State <> 5 And u.Activity = 1 GROUP BY u.User_idGO
In this way works partially, only are selected the users that published offers in the specified date, but I also want to show the rest of selected users (u.Activity = 1) and show 0 (zero) offers in Offers column. How can I achieve it?Thank you,Cesar