Trouble with my SQL join/group by/cursor question
Date : March 29 2020, 07:55 AM
will be helpful for those in need I've made database design for a small CRM system. It comprises of Companies and Meetings (amongst others). , Try: select Companies.ID, Companies.name, mts.whentime, mts.notes
from Companies
cross apply
(
select top(1) *
from Meetings
where Companies.ID = Meetings.companyID
order by [whentime] desc
) mts
order by Companies.name asc;
|
Using Linq to Join,Group By and Count.... facing a trouble
Tag : chash , By : m0gb0y74
Date : March 29 2020, 07:55 AM
wish of those help You could group an anonymous class. That way you can access both p & l properties. Looks like this : var total = from p in db.picturedetails
join l in db.picturelikes on p.idpictures equals l.idpictures
group new {p,l} by l.idpictures into g
select new
{
IdUserPic = g.First().p.iduser,
IdPictures = g.First().p.nuditylevel,
totalrating = g.Count()
}
|
Trouble with two table join and Group By working together
Tag : sql , By : Andrew Bailey
Date : March 29 2020, 07:55 AM
To fix this issue First, learn to use proper, explicit JOIN syntax. Second, the unaggregated columns in the SELECT need to match the GROUP BY columns. Third, use table aliases: SELECT s.Last_Name || ', ' || s.First_Name AS "Student Name"
FROM Student s JOIN
Grade g
ON s.Student_Id = g.Student_Id
GROUP BY s.Last_Name || ', ' || s.First_Name
HAVING AVG(g.Numeric_Grade) > 92
ORDER BY s.Last_Name || ', ' || s.First_Name;
|
Having trouble with Group by and Join EF c#
Tag : chash , By : user186876
Date : March 29 2020, 07:55 AM
To fix this issue I am having trouble converting this T-SQL code into EF C# , A direct translation would look more like this: from u in ctx.Users
join hc in ctx.HContainers on u.Hcid equals hc.Hcid
join us in ctx.UserSettings on hc.Sid equals us.Sid
where u.Created.Day == 18
group u.Userid by us.Pcname into g
let total = g.Count()
orderby total descending
select new
{
pcname = g.Key,
total,
}
|
Trouble ordering GROUP BY, ORDER BY AND JOIN
Tag : sql , By : Matthew Steed
Date : March 29 2020, 07:55 AM
I wish this helpful for you i'm having trouble ordering a query. , you could use a join SELECT
ATTENDANCELOG.studentpin,
Students.FNAME,
Students.LNAME,
SUM(CASE WHEN status = 'YES' THEN 1 ELSE 0 END) AS number_of_yes,
SUM(CASE WHEN status = 'NO' THEN 1 ELSE 0 END) AS number_of_no
FROM attendancelog
INNER JOIN Students ON Students.STUDENTPIN = attendancelog.StudentPin
and INTERNATIONAL='YES'
GROUP BY ATTENDANCELOG.studentpin, Students.FNAME, Students.LNAME
ORDER BY ATTENDANCELOG.studentpin
|