SQL:语法错误(“from”附近:语法错误)

时间:2021-02-18 11:33:11

标签: sql

select 
    rf.policy_type_code, rf.policy_type_name,
    up.policy_type_id, up.user_id, up.policy_no
from 
    ref_policy_types rf 
join
    policy_sub_types ps 
join 
    user_policies up on rf.policy_type_code = ps.policy_type_code 
                     and up.policy_type_id = ps.policy_type_id
where 
    extract(month from adddate(up.date_registered, interval ps.maturityperiod month)) = '7'
    and extract(year from adddate(up.date_registered, interval ps.maturityperiod month)) = '2013';

2 个答案:

答案 0 :(得分:0)

试试这个,还请检查SQL函数名和参数顺序是否正确。

SELECT rf.policy_type_code,
       rf.policy_type_name,
       up.policy_type_id,
       up.user_i d,
       up.policy_no
FROM ref_policy_types rf
    JOIN policy_sub_types ps
        ON rf.policy_type_code = ps.policy_type_code
    JOIN user_policies up
        ON up.policy_type_id = ps.policy_type_id;
where extract(month from adddate(up.date_registered,interval ps.maturityperiod month))='7' 
and extract(year from adddate(up.date_registered,interval ps.maturityperiod month))='2013';

答案 1 :(得分:0)

缺少的 #container { display: flex; justify-content: center; font-size:12px; margin-top:10px; } #container1 { display: flex; justify-content: center; font-size:12px; } .fnt{ font-weight: 400; font-size: 1.5rem; line-height: 2.4rem; text-align: right; /* the left side is aligned right */ } #parent > div { display: flex; /* change grid to flex */ justify-content: flex-start; flex-direction: row; /* actually you don't have to set this, because the default value of flex-direction is 'row' */ } #parent > div > div { width: 100px /* set width for div inside .container */ } #parent > div > div:nth-child(2n) { width: 10px; /* set slash width */ margin-left: 5px; margin-right: 5px; } #parent > div > div:not(.fnt) { font-weight: 400; font-size: 1.5rem; line-height: 2.4rem; } #parent > div > div:last-child{ text-align: left; } 子句肯定是语法错误(至少在大多数数据库中;在 MySQL 中,on 是可选的)。但是,我不确定它会在您的问题中产生错误。

整数的比较(从 on 到字符串很尴尬——你不应该混合类型。另外,我建议只使用日期。我更喜欢直接日期算法:

extract())