SQL代码错误与“预期”输入不匹配

时间:2018-09-19 05:56:18

标签: sql apache-spark parseexception

您好,以下是我的SQL代码,它给我错误,我不知道为什么。如果有人可以帮助。

import React, { Component } from 'react';
import { Image } from 'react-native';


class EventCard extends Component {

  constructor(props) {
    super(props);

    const imgUrl = props.image || require('../assets/images/image.jpg');
    this.state = { image: imgUrl };
  }

  render() {
    return (
      <Image
        source={this.state.image}
      />
    );
  }
}

export default EventCard;

它给了我错误提示: org.apache.spark.sql.catalyst.parser.ParseException: 输入不匹配,来自“ from”,预期{,“ WHERE”,“ GROUP”,“ ORDER”,“ HAVING”,“ LIMIT”,“ LATERAL”,“ WINDOW”,“ UNION”,“ EXCEPT”,“ INTERSECT”,“ SORT” ','CLUSTER','DISTRIBUTE'}(第3行,位置0)

2 个答案:

答案 0 :(得分:0)

尝试以下查询

select a.time_dif, count(a.time_dif) as time_dif_count 
from 
(
select datediff(day,so_so_close_time,date_closed) as time_dif
from mbg_service_prd.mds_service_orders_base_cdl
inner join mbg_service_prd.rnt_incident_detail_base_cdl
on 
(srv_customer_phone = mobile_phone or srv_customer_email = email_address)
where (
(srv_customer_phone <> '' or srv_customer_phone is not null)
or (srv_customer_email <> '' or srv_customer_email is not null) 
or (mobile_phone <> '' or mobile_phone is not null) 
or (email_address <> '' or email_address is not null) 
)
)a
group by a.time_dif
order by a.time_dif

答案 1 :(得分:0)

datediff函数存在错误。我们在datediff中使用了三个参数,即interval,date1,date2。 DATEDIFF(interval,date1,date2)。