select * from artist as a , cartoon as b where b.cartoon_name like '%n%' and a.artist_id = b.artist_id ;
这样一个语句artist是作者的表,cartoon是作者的漫画的表。
通过上面的语句可以查出,cartoon表中的cartoon_name列中带有“n”的作者的列表。
但是我想通DetachedCriteria来查询,就发现,会有重复的列。
期盼得到解答!谢谢
[url]http://www.iteye.com/topic/32347[/url]
[url]http://wangjian5748.iteye.com/blog/86150[/url]
你这个sql要用外连接
select * from artist as a left join cartoon as b on a.artist_id = b.artist_id where b.cartoon_name like '%n%' ;