简体   繁体   English

如何在mysql中比较两个结果集?

[英]How to compare the two resultsets in mysql?

for(int i=0;i<resultset.length;i++)
{
a = select meta_value from wp_postmeta where meta_key ='movie name' and post_id = resultset(i)
}
resultset = (select object_id from wp_term_relationships where term_taxonomy_id = (select term_taxonomy_id from wp_term_taxonomy where taxonomy = 'actors' and term_id = (Select term_id from wp_terms where name = 'Aamir khan'))


for(int i=0;i<resultset.length;i++)
{
b = select meta_value from wp_postmeta where meta_key ='movie name' and post_id = resultset(i)
}
resultset = (select object_id from wp_term_relationships where term_taxonomy_id = (select term_taxonomy_id from wp_term_taxonomy where taxonomy = 'actors' and term_id = (Select term_id from wp_terms where name = 'Salman khan'))

the value for a & b are the names of the movies done by these actors, i just want to compare these two, and if there is any common movie then it will display that. a&b的值是这些演员完成的电影的名称,我只想比较这两个电影,如果有任何普通电影,它将显示该电影。 If i am not on the write path then please tell me the right path. 如果我不在写路径上,请告诉我正确的路径。 This has to be done on wordpress 这必须在wordpress上完成

您可以对两个结果使用JOIN: 这是一个快速介绍

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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