mysql - Query two databases in the same server -


I have two databases in the same server and I need it:

  table1 Choose from (in database 1) id field where notific1 = 1   

but only user_id list

  where in table 2 ( Database2)) enabled field = 1   

Being a user_id field in both tables.

I tried:

  SELECT table1 [Database 1]. [Dbo] [Dpa]. [Table 1] such as user INNER JOIN [database2]. [Dbo] [Table 2] On subs on users. User-id = subs.user_id where the user Anotif 1 = 1 and where subs.enabled = 1   

is throwing this error:

. # 1064 - There is an error in your SQL syntax; To use near [database 1], check the manual related to your mess SQL Server edition for the correct syntax. [DPO]. [Table 1] such as user INNER JOIN [database2]. Note: I am using MySQL

"Text">

You did not have 2 as you did, (because you tagged your question with Mysql)

  WHERE users.notific1 = 1 AND WHERE Subs.enabled = 1   

should be

  where users.notific1 = 1 and subs.enabled = 1   < P> 2 is also syntax when joining the database  
  select * proj1.users from y inner project 2.users f on f.email = y.email and y.email = ' Abhik@xxxx.com '  

Proj1 and project2 are in the same server as 2 databases and users are those tables in the database.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -