【问题标题】:Fetch Issue In Record Field在记录字段中获取问题
【发布时间】:2021-11-08 07:44:13
【问题描述】:

我的架构是 mongoid STRING NULLABLE
order_vfid STRING NULLABLE
order_storeid STRING NULLABLE
order_filterdate DATETIME NULLABLE
order_sortdate DATETIME NULLABLE
order_time DATETIME NULLABLE
order_shopify_name STRING NULLABLE
order_shopify_id STRING NULLABLE
shipping_address 重复记录
customer_details 记录重复
order_payment_status STRING NULLABLE
order_fulfillment_status STRING NULLABLE
order_status STRING NULLABLE
order_currency STRING 可为空
order_total_paid FLOAT NULLABLE
is_cod INTEGER NULLABLE
line_items 记录重复
lineitem_id STRING NULLABLE
vfsku 字符串可以为空
product_shopifyid STRING NULLABLE
variant_shopifyid STRING NULLABLE
数量 FLOAT NULLABLE
名称 STRING NULLABLE
目录名称 STRING NULLABLE
item_total_sold_price FLOAT NULLABLE
折扣 FLOAT NULLABLE
确认日期 STRING NULLABLE
item_vforderstatus STRING NULLABLE
product_status STRING NULLABLE
输入 STRING NULLABLE
total_shipping2 FLOAT NULLABLE
shipping_perquantity2 FLOAT NULLABLE
vfprodid STRING NULLABLE

现在我正在使用查询获取数据,但出现错误。请帮帮我。 我的查询是 SELECT * FROM testdata.orders where line_items.vfsku = 'VFPQ123_VT1'

【问题讨论】:

  • 错误是什么?

标签: google-bigquery


【解决方案1】:

查看如何scan for STRUCT field values that satisfy a condition:

SELECT *
FROM testdata.orders
WHERE EXISTS(SELECT 1 FROM UNNEST(line_items) WHERE vfsku = 'VFPQ123_VT1');

【讨论】:

    【解决方案2】:

    试试这个

    SELECT *
    FROM testdata.orders,UNNEST(line_items)
    WHERE vfsku = 'VFPQ123_VT1';
    

    【讨论】:

    • 发生错误:无法访问类型为 ARRAY> 的字段 vfsku
    • 修复了错误。
    • 现在它没有给出正确的结果。它给出了所有结果,但也不满足条件。
    • 肯定满足条件。所有结果是什么意思?您需要在问题中添加所有信息以获得预期的输出。我看到 Sergey 的代码运行良好。继续吧。如果您想在此处了解更多信息,请添加有问题的额外信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多