select 相当于 for 循环
select id from IDArray linkedList a = new linkedList(); for ( int i=0 ; i当执行子查询时,可以理解为
select id, ( select name from nameArray) as names ,from Idarray linkedList a = new linkedList(); for ( int i=0 ; i很明显这里一对多了。所以执行不对。报SQL错误
所以在 select中,应该要具体确定某一个值
select id, ( select name from nameArray where nameId=id) as names from Idarray linkedList a = new linkedList(); for ( int i=0 ; i当且仅当if 条件的值搜索是单个值的时候,是对应上的
那么groupBy呢?
select id, ( select name from nameArray where nameId=id) as names from Idarray group by id linkedList a = new linkedList(); for ( int i=0 ; ilinkedList groupByArray = new linkedList(); for ( int i=0 ; i< a. length ; i++){ int id = a[i].getId(); linkedList tempArray = new linkedList(); for ( int j=0 ; j以上这篇利用Java理解sql的语法(实例讲解)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持考高分网。



