Link to home
Start Free TrialLog in
Avatar of swaggrK
swaggrK

asked on

SQL...Joining VIEWS

I have multiple views, that I need to join together.
I am having a difficult time getting the data to appear like I want.


VIEW 1:

SELECT ORG_ID, ORGANIZATION_NAME, [GROUP], category_id, rpt_list_text, APRN, PA
  FROM vw_core_privileges_a16

ORG_ID	ORGANIZATION_NAME	GROUP	category_id	rpt_list_text	APRN	PA
1	       Northwestern Memorial Hospital	UHC	1	Write admission orders	1	1
2	       Rush University Medical Center	UHC	1	Write admission orders	1	1
3	       University of Chicago	                UHC	1	Write admission orders	1	1

Open in new window



VIEW 2:

SELECT ORG_ID, ORGANIZATION_NAME, [GROUP], category_id, rpt_list_text, APRN, PA
  FROM vw_core_privileges_a17

ORG_ID	ORGANIZATION_NAME	    GROUP	     category_id	rpt_list_text	APRN	PA
1	       Northwestern Memorial Hospital	UHC	    1	  Write discharge orders	   1	1
2	       Rush University Medical Center	UHC	    1	  Write discharge orders	   1	1
3	       University of Chicago	               UHC	    1 	  Write discharge orders	   1	1

Open in new window




I would like the data to appear like:

ORG_ID	ORGANIZATION_NAME	GROUP	category_id	rpt_list_text	APRN	PA
1	       Northwestern Memorial Hospital	UHC	    1	  Write admission orders	   1	  1
2	       Rush University Medical Center	UHC	    1	  Write admission orders	   1	  1
3	       University of Chicago	                UHC	    1	  Write admission orders	   1	  1
1	       Northwestern Memorial Hospital	UHC	    1	  Write discharge orders	   1	  1
2	       Rush University Medical Center	UHC	    1	  Write discharge orders	   1	  1
3	       University of Chicago	               UHC	    1 	  Write discharge orders	   1	  1

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Saurabh Bhadauria
Saurabh Bhadauria
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of swaggrK
swaggrK

ASKER

Thank you, where is the best place to store this query, since it is not really a View?
Avatar of swaggrK

ASKER

Excellent!!! Responded very quickly. Thank you.
ok then you can wrap your queries in a view...in  similar way