如何在Google表格中的表格和查询之间连接表格

时间:2018-01-09 09:00:32

标签: sql google-sheets

在Sheet2中,我有以下列〜1000行

[ NAME      EMAIL-ADDRESS       PHONE       PRODUCT ]

在Sheet3中,我有以下列,包含3000行

[ company   first_name  last_name   full_name   email   amount ]

我需要通过加入表来获得结果,即

Sheet3 email = Sheet2 EMAIL ADDRESS

first_name last_name (from Sheet3), email address (from Sheet3), PRODUCT (from Sheet2), amount (from Sheet3)

如何获得此功能,即使它是Google表格中的自定义功能

也可以

我试过

=QUERY(Sheet2!A1:D3000, "Select B & ' ' & C WHERE B='" & Sheet3!$E2 & "'", 0)

2 个答案:

答案 0 :(得分:1)

Sample Sheet

您可以在一个公式中使用filter + vlookup

=FILTER( {Sales!B14:B,Sales!C14:C,Sales!E14:E, vlookup(Sales!E14:E,{People!B2:B,People!D2:D},2,), Sales!F14:F},Sales!E14:E<>"")

FIlter会将vlookup转换为ArrayFormula。这将从表&#34; People&#34;。

返回PRODUCT

我重命名了工作表以给他们更有意义的名字。

  • &#34;销售&#34; =&#34; Sheet3&#34;
  • &#34;人&#34; =&#34; Sheet2&#34;

答案 1 :(得分:-1)

尝试此查询!

SELECT 
             s3.first_name     AS  ‘First Name’  ,
             S3.last_name      AS  ‘Last Name’   ,
             s3.email          AS  ‘Email’       ,
             s2.PRODUCT        AS  ‘Product’     ,
             s3.amount         AS  ‘Amount’
    FROM 
             Sheet2 s2                           ,
             Sheet3 s3
    WHERE
            s2.EMAIL_ADDRESS  =  s3.email