android 多表联合查询 as 用法 -----断点记录
想查询出通话日志中的通讯录,发现如果用
String selection ="0=0) group by (date"
String [] projection = new String []{
"_id",
"(select [data] from photos as photos where photos.person =(select person from phones as phones where phones.number = number)) as avatars", // 头像
};
query(URI,projection,selection,null,null,null);
显示的时候总是显示同一个头像,
把sql语句放数据库中执行也是如此.
后面在数据库中写了 没有错误数据的sql语句:
select _id,
??(select [data] from photos as photos where photos.person =(select person from phones as phones where phones.number =?as? ?calls. number)) as avatars
from calls?as calls?
这里用到了 as..
但是却在java中怎么写卡住了.
后面结果版主的指点
写法如下:
?
String [] projection = new String []{
?
"_id,?(select [data] from photos as photos where photos.person =(select person from phones as phones where phones.number =?as? ?calls. number)) as avatars
from calls?as calls?--" ? // 用到了 "--" 注释 //注释所有以后系统自动生成的sql语句
};
query(URL,projection,null,null,null,null);
达到了想要的效果.
20110919
?