Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Miscellaneous >> SQL query with 2 different Schemas

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: SQL query with 2 different Schemas
 sathi  Posted: Jun 01, 2007 02:16:08 AM

 Total Post: 5
 Joined: Feb, 2007






 Hi,

I want to fetch and compare data from two different schemas/users in a single SQL query.

I have 2 different users named user1 and user2. I have different table names but with the same column names. I want to join the two users user1 and user2 and compare the same columns.

Any help on this is highly appreciated.

Thanks in advance.

 Vigyan
Posted: Jun 04, 2007 11:16:50 AM  

 Total Post: 386
 Joined: May, 2001






 
You can use grant to select table from another schema.

e.g.

Grant select on table_name to user1;

now from connect as user1 and write the sql statement like below.

select a.col1, b.col1 from user1.table_name1, user2.table_name2 where ....

Hope this helps.

Vigyan



 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar357
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software