I have two tables of customer and order,I want to filter out the customer_id which meets the demand of step1 and step2,while when I do the step2.5,the console shows
Error: Cannot pass NA to dbQuoteIdentifier() In addition: Warning message: In field_types[] <- field_types[names(data)] : number of items to replace is not a multiple of replacement length
step1<- sqldf("select * from customer_table as ct inner join order_table as ot ON ct.customer_id=ot.customer_id where order_date<20161222 and order_amount=1 group by ct.customer_id;")
step2<- sqldf("select ot.customer_id from order_table as ot
where order_date between 20161222 and 20170222
and order_amount=0
group by ot.customer_id;")
step2.5<- sqldf("select * from step1 as s1 inner join step2 as s2 on s1.customer_id=s2.customer_id; ")
Someone could help?Thanks