Python init method vs. SQL statement current time

Source: Internet
Author: User

DEF init (SELF,CR):
Tools.sql.drop_view_if_exists (CR,' Custrom_product_infomation_report ')
Cr.execute ("""
Create or Replace viewcustrom_product_infomation_report as (
Select t0.id,t0.hpartner_id as hpartner_id, T0.khwl_code as khwl_code,t1.product_tmpl_id as PRODUCTN,
T3.pname,t3.material,t3.spec,
T4.id as Name_uom, T5.price as Custo_price,t0.product_meno as Product_meno, T0.meno as Meno,t5.date_from,t5.date_to
From Product_custo_info t0
Left JOIN product_product T1 on t0.product_tmpl_id=t1.product_tmpl_id
Left JOIN product_template T3 on t3.id=t1.product_tmpl_id
Left JOIN Res_partner T2 on t2.id=t0.hpartner_id
Left JOIN product_uom T4 on T3.uom_id=t4.id
Left join Partner_product_price T5 on T5.ppp_line_id=t0.id






SQL statement when compared to the previous time:

Select * FROM (select  T1.id,t0.product_meno,
 t0.hpartner_id, T0.khwl_code, T0.name_uom,t0.custo_price  
, T0.product_meno,t0.meno,t2.pname, t0.date_from,t0.date_to
From cust_product_info_report  t0  ,
left JOIN product_product t1 on t1.product_tmpl_id=t0.productn  < Br>left JOIN product_template t2  on t1.product_tmpl_id=t2.id
where  (now ( ) >=t0.date_from  and now () <=t0.date_to) or  (T0.date_from was null and t0.date_to is null)   or
(T0.date_from is null and (now () <=t0.date_to))   or (T0.date_to is null and ( Now () >=t0.date_from)
 )
 as p where  hpartner _id= ' 16404 '  
 order by PName

Python init method vs. SQL statement current time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.