Home>

Where clause condition statement written in MySQL.

I want to rewrite this to standardSQL so that it can be passed with Bigquery. If i have any corrections, please give me a professor.

where konyu_id in (
    select kaiin_id
    from D_CART dch (NOLOCK)
    where insdate>= '2017-07-01' and insdate<'2018-07-01'
    and bought = 1 and kaiin_id>0
    group by kaiin_id
    having count (*)>1
)
  • Answer # 1

    I can't say anything because I don't know the whole picture

    group by doing count (*)>1 means
    You're just checking for data?
    If so

    select distinct kaiin_id
        from D_CART
        where insdate '2017-07-01' and '2018-06-30'
        and bought = 1
        and kaiin_id>0


    Is n’t it like that?