且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL JOIN语句-同一表中的引用字段

更新时间:2022-12-12 16:21:48

这将为您提供被引用的记录和有效的记录

This will give you those records which are referenced and those which are valid

SELECT * 
FROM   yourtable A 
       INNER JOIN yourtable B 
               ON A.reference_id = B.order_id 
WHERE  B.reference_type > 0;