Problem with SQL Query...

Results 1 to 2 of 2

Thread: Problem with SQL Query...

  1. #1
    Nils Kaiser Guest

    Default Problem with SQL Query...

    I have a problem with a SQL query.<BR>I have these 3 queries...<BR><BR>SELECT UserID AS dID, COUNT(*) AS dCount FROM Members_Delicts GROUP BY UserID<BR>SELECT UserID AS cID, COUNT(*) AS cCount FROM Members_Cautions GROUP BY UserID<BR>SELECT UserName, ID FROM Members<BR><BR>... but now i need all this in one query that returns this<BR><BR>SELECT UserName, dCount, cCount FROM ????<BR><BR>How can I do that?<BR><BR>Thanks...

  2. #2
    Sateesh Guest

    Default Here we go

    make it a sub query like<BR><BR>select Mem.Username, Mem.Id, MEM_Del.count, MEM_Del.Cid, Mem_Cau.count from <BR>memebers Mem,<BR>(select UserId as Cid,count(*) as ccount from members_cautions group by UserID)Mem_Del <BR>...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts