简体   繁体   中英

Join two tables in different databases with setting limit MySQL

How can I set limit for inner join two tables in different databases?

SELECT a.*, b.*
FROM  tsv_test.title_ratings a
      INNER JOIN movielens.links b    
         ON a.tconst = b.imdbid

You can read about LIMIT HERE

You can also read about ORDER BY HERE

The syntax for them based on the SQL you posted would be:

SELECT a.*, b.*
FROM  tsv_test.title_ratings a
      INNER JOIN movielens.links b    
      ON a.tconst = b.imdbid
      ORDER BY a.field_name ASC
      LIMIT 10

Note that I don't know what your field names are, so I threw in a.field_name so you can see what the syntax looks like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM