根据角色和帐单地址drupal查询用户(Querying Users based on role and billing address drupal)

编程入门 行业动态 更新时间:2024-10-24 08:29:24
根据角色和帐单地址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

更多推荐

本文发布于:2023-08-04 00:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1405178.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:帐单   角色   地址   用户   drupal

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!