Cursor draftcursor = Mresolver.query (Uri.parse ("Content://sms"),
New string[] {"Canonical_addresses.address" +
"From sms,threads,canonical_addresses" +
"Where sms.thread_id=threads._id and threads.recipient_ids=canonical_addresses._id and sms._id = '" +
String.valueof (target_message_id) + "'--"},
NULL, NULL, NULL);
A little tricky, right, using the comment notation in the SQL statement "--"
So we're going to turn this statement into:
Select Canonical_addresses.address from sms,threads,canonical_addresses where sms.thread_id=threads._id and threads.recipient_ids=canonical_addresses._id and sms._id = ' target_message_id '--from SMS
--from SMS is not parsed when the SQL statement is parsed, so the previous Federated query operation was successfully performed and the address data in the Canonical_addresses table we wanted was obtained.
Quote Original: http://blog.csdn.net/zhangzh332/article/details/6396985
Query the android system database custom SQL statement method