samedi 27 juin 2015

How to join a table without any common field in mysql?

Below are the tables I'm working on,

tableA

╔════╦══════════════╦══════╗
║ ID ║  REVLIMIT    ║ REV  ║
╠════╬══════════════╬══════╣
║  1 ║ 8500         ║  69  ║ 
╚════╩══════════════╩══════╝

tableB

╔════╦══════════════╦ 
║ KID║   Model      ║  
╠════╬══════════════╬ 
║  1 ║ 43453453345  ║  
║  2 ║ 23423423     ║  
║  2 ║ 5566533      ║  
╚════╩══════════════╩ 

I need to join table with table B so that I get the below result

tableC

╔════╦══════════════╦══════╗
║ KID║  Model       ║ REV  ║
╠════╬══════════════╬══════╣
║  1 ║ 43453453345  ║  69  ║
║  1 ║ 2433423423   ║  69  ║
║  2 ║ 23423423     ║  69  ║
║  2 ║ 5566533      ║  69  ║
╚════╩══════════════╩══════╝

ie all the Model in tableB should have REV as 69 in this case.

I can use only plain MySQL query,How to accomplish that? Thanks in advance

Aucun commentaire:

Enregistrer un commentaire