根据角色和帐单地址drupal查询用户(Querying Users based on role and billing address drupal)
我正在尝试编写一个查询,根据用户的角色和帐单地址显示用户列表。
我得到了结果,但有些数据是错误的。 例如,我知道有些用户在英国现场直播,但显示的是美国地址。
我的查询是
`SELECT u.uid, u.name, mail, commerce_customer_address_country, commerce_customer_address_postal_code, fdcca.entity_id FROM users u INNER JOIN users_roles ur ON ur.uid = u.uid INNER JOIN user_address ua ON ua.uid = u.uid INNER JOIN field_data_commerce_customer_address fdcca ON ua.address_id = fdcca.entity_id WHERE ur.rid = 11 AND commerce_customer_address_country != 'GB' LIMIT 50`我想我的连接错了,但我有点失落,并会感激任何提示。
I am trying to write a query that displays a list of users based on their role and billing address.
I am getting results back but some of the data is wrong. I know for instance that some of the users returned live in the UK but a US address is showing.
The query I have is
`SELECT u.uid, u.name, mail, commerce_customer_address_country, commerce_customer_address_postal_code, fdcca.entity_id FROM users u INNER JOIN users_roles ur ON ur.uid = u.uid INNER JOIN user_address ua ON ua.uid = u.uid INNER JOIN field_data_commerce_customer_address fdcca ON ua.address_id = fdcca.entity_id WHERE ur.rid = 11 AND commerce_customer_address_country != 'GB' LIMIT 50`I think I have got the joins wrong but I am a bit lost, and would appreciate any tips.
最满意答案
使用视图模块而不是函数: https : //api.drupal.org/api/views/views.module/function/views_get_view_result/7
Use views module instead and function: https://api.drupal.org/api/views/views.module/function/views_get_view_result/7
更多推荐
发布评论