在HiveSQL中转义单引号

时间:2019-01-17 19:20:25

标签: hive hiveql

我有一个基本查询,该查询可以在HUE中成功运行,但不能在RazorSQL(IDE)中运行。我尝试了多种转义单引号的方法,但无济于事。

select * from table where channel_name = "This isn't it"; --what I want to run and runs successfully in HUE

--the following returns me nothing or give me an error
select * from table where channel_name = "This isn"'t it";
select * from table where channel_name = "This isn\'t it";

select * from table where channel_name = This isn"'t it';
select * from table where channel_name = 'This isn\'t it';

1 个答案:

答案 0 :(得分:0)

找出我自己问题的答案。 RazorSQL(或其他任何IDE)中的Hive SQL在查询结束时不喜欢分号。

所以代替          从表中选择*,其中channel_name =“这不是”; 做          从表中选择*,其中channel_name =“不是”