Advertisement

[x]
Attachment Details

Getting same data across multiple tables

[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2
Tags: , , , ,
Hi experts,
I have this sql statement which pulls in data from one table perfectly. My question is how do I join this sql to get more data across another 10 tables. The tables have the same data/format and are linked by ADMIT_PHY_MNE(MAIN TABLE)  = WDRGPHY ( 10 working tables).

I need a total count of the 3 reponses across these 10 tables.

The 10 tables are names tbl_extra2 ....tbl_extra10.

SELECT  MONTH(DISCHARGEDATE) AS [Month2], YEAR(DISCHARGEDATE) AS [YEAR2], ADMIT_PHY_MNE, (SELECT     COUNT(*)  FROM          tbl_3minfo t0   WHERE      o.ADMIT_PHY_MNE = t0.ADMIT_PHY_MNE AND t0.MDRESPONSE = 'Agreed and documented'  GROUP BY MONTH(t0.DISCHARGEDATE), YEAR(t0.DISCHARGEDATE), t0.ADMIT_PHY_MNE HAVING      MONTH(t0.DISCHARGEDATE) = MONTH(o.DISCHARGEDATE) AND YEAR(t0.DISCHARGEDATE) = YEAR(o.DISCHARGEDATE))  AS MDRESPONSE_YES_COUNT, (SELECT     COUNT(*) FROM  tbl_3minfo t1 WHERE  o.ADMIT_PHY_MNE = t1.ADMIT_PHY_MNE AND t1.MDRESPONSE = 'Disagree' GROUP BY MONTH(t1.DISCHARGEDATE), YEAR(t1.DISCHARGEDATE), t1.ADMIT_PHY_MNE HAVING MONTH(t1.DISCHARGEDATE) = MONTH(o.DISCHARGEDATE) AND YEAR(t1.DISCHARGEDATE) = YEAR(o.DISCHARGEDATE))  AS MDRESPONSE_NO_COUNT, (SELECT     COUNT(*)  FROM  tbl_3minfo t2  WHERE o.ADMIT_PHY_MNE = t2.ADMIT_PHY_MNE AND (t2.MDRESPONSE = 'No Response' OR  t2.MDRESPONSE IS NULL OR t2.MDRESPONSE ='') GROUP BY MONTH(t2.DISCHARGEDATE), "&_
"YEAR(t2.DISCHARGEDATE), t2.ADMIT_PHY_MNE HAVING MONTH(t2.DISCHARGEDATE) = MONTH(o.DISCHARGEDATE) AND YEAR(t2.DISCHARGEDATE) = YEAR(o.DISCHARGEDATE))  AS MDRESPONSE_NO_RESPONSE_COUNT, (SELECT     COUNT(*) FROM  tbl_3minfo t3 WHERE o.ADMIT_PHY_MNE = t3.ADMIT_PHY_MNE GROUP BY MONTH(t3.DISCHARGEDATE), YEAR(t3.DISCHARGEDATE), t3.ADMIT_PHY_MNE  HAVING MONTH(t3.DISCHARGEDATE) = MONTH(o.DISCHARGEDATE) AND YEAR(t3.DISCHARGEDATE) = YEAR(o.DISCHARGEDATE))  AS MDRESPONSE_ALL_COUNT FROM tbl_3minfo o WHERE DISCHARGEDATE between CAST('" & str1 & "' AS datetime) AND CAST('" & str2 & "' AS datetime) GROUP BY MONTH(DISCHARGEDATE), YEAR(DISCHARGEDATE), ADMIT_PHY_MNE ORDER BY MONTH(DISCHARGEDATE), ADMIT_PHY_MNE
Related Solutions
Related Solutions
 
Loading Advertisement...
 
Accepted Solution by volking:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Genius

Assisted Solution by bhess1:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Genius

Expert Comment by bhess1:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by cseink:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by cseink:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
Loading Advertisement...
20080924-EE-VQP-40