Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:47:00+00:00 2026-05-27T06:47:00+00:00

select p.intprojectid, p.vcprojectname, md.intmoduleid, md.vcmodulename, md.intscreensfunc, md.vcname from projects as p left join (select

  • 0
select p.intprojectid, p.vcprojectname, md.intmoduleid, 
       md.vcmodulename, md.intscreensfunc, md.vcname 
from projects as p 
left join (select m.intprojectid, m.intmoduleid, m.vcmodulename, 
                  s.intscreensfunc, s.vcname 
           from modules as m 
           left join screens_func as s on m.intmoduleid = s.intmoduleid) md 
           on p.intprojectid = md.intprojectid

This query will return:

no |project-name|mod-id|mod-name  |  screen-id   |  screen-name
----------------------------------------------------------------
2   Project-1     4      mod-1          11            scr1
2   Project-1     4      mod-1          12            scr2
2   Project-1     4      mod-1          13            scr3
2   Project-1     4      mod-1          14            scr4
2   Project-1     8     Module-2       NULL           NULL

Now I want to count no.of mod-name and no.of.screen-name in project-1. i.e. I want the query to return

project-name     no.of.mod          no.of.screen
------------------------------------------------
Project-1          2                    4
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:47:01+00:00Added an answer on May 27, 2026 at 6:47 am

    It’s definitely possible to return multiple counts.

    In other words, your query could be modified as follows:

    select p.vcprojectname, COUNT(DISTINCT md.intmoduleid) as no.of.mod, COUNT(md.intscreensfunc) as no.of.screen
    from projects as p 
        left join (select m.intprojectid, m.intmoduleid, m.vcmodulename, s.intscreensfunc, s.vcname 
                   from modules as m 
                   left join screens_func as s 
                            on m.intmoduleid=s.intmoduleid)md 
               on p.intprojectid=md.intprojectid
    GROUP BY p.vcprojectname
    

    Based on your example data, I inferred that there would be a one-many relationship between modules and screens and thus you would want a distinct count for modules but that the same requirement would not be needed for screens (since it appears that one screen would not appear multiple times in a given module) If that is not the case, you can also add distinct to the count of screens.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SELECT pe.prodtree_element_id prodID, pe.prodtree_element_name_s, li.line_name, av2.value FROM prodtree_element pe LEFT JOIN prodtree_link pl ON
select picks.`fbid`, picks.`time`, categories.`name` as cname, options.`name` as oname, users.`name` from picks left join
SELECT sysobjects.xtype, syscolumns.name, sysindexkeys.indid, sysobjects.type FROM syscolumns LEFT JOIN sysobjects ON syscolumns.id = sysobjects.id
SELECT * FROM Table_A LEFT JOIN Table_B ON (Table_A.A_ID = Table_B.A_ID) INNER JOIN Table_C
select email from mailing list This is the query i want to use if
select * from table where key='çmyk' when i run this query on table that
select homephone,lastName from DEBTOR where contains((lastName,homephone),'Smith AND 99 999 9999') The first query returns
SELECT COUNT(*) FROM song AS s JOIN user AS u ON(u.user_id = s.user_id) WHERE
SELECT Login.LoginID, Student.[Student Name], Student.[Student address], Student.StudentID FROM Login INNER JOIN Student ON Login.LoginID
select count(*) as count from table group by foreign_id order by count This returns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.