`
zengyan2012
  • 浏览: 409853 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

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

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics