Monday, 15 September 2014

oracle - updating my customer table-sql -



oracle - updating my customer table-sql -

good morning all, writing code update client table,

update alekwe_customer c set recently_purchased= (select case when (date_purchased between add_months(sysdate,-12) , sysdate) 'y' else 'n' end alekwe_customer_product d c.customer_id=d.customer_id)

but bringing error

single query returning more 1 row

is there improve way can write code? thankks help

if need find out if client has purchased year can utilize max function ('y' > 'n') 1 row:

update alekwe_customer c set recently_purchased = (select max(case when (date_purchased between add_months(sysdate,-12) , sysdate) 'y' else 'n' end ) alekwe_customer_product d c.customer_id=d.customer_id )

sql oracle

No comments:

Post a Comment