开发者

SQLite & MySQL - Same Query - Different Results - Multiple Joins

I have 2 databases with the same data, but slightly different data types in some fields (eg SQLite DB has TEX开发者_如何学运维T where MySQL DB has varchar(50))

I run the following query:

SELECT * 
FROM audio a, 
  audiocodec ac, 
  fileproperties f, 
  transportstream t, 
  transportservice ts, 
  video v, 
  videocontent vct, 
  videoFrameRate vf, 
  videocodec vc 
WHERE 
f.PK_filename = a.filename 
AND a.codec = ac.PK_audioCodecID 
AND f.PK_filename = a.filename 
AND f.PK_filename = t.filename 
AND t.services = ts.PK_serviceID 
AND f.PK_filename = v.filename 
AND v.content = vct.PK_contentID 
AND v.frameRate = vf.PK_frameRateID 
AND v.codec = vc.PK_videoCodecID

Done in the MySQL DB, I get 10 results as expected. In SQLite, 2 results. Any reasons? (I understand that this maybe difficult to answer be not specifying the datatypes and constraints I have made with the tables)


One thing I noticed is that f.PK_filename = a.filename is twice in your WHERE statement (which is probably not the reason for the different results you get, but still somehow noteworthy).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜