in-subquery

Hive - Where and OR clause error

情到浓时终转凉″ 提交于 2021-02-08 05:56:07
问题 Hi I am trying to run this query in Hive, but get the error 10249 (Unsupported query expression - only 1 subquery is supported...) select count(*) from ( select * from tableA union all select * from tableB ) a where a.field1 in (select fieldA in tableC) or a.field2 in (select fieldA in tableC) or a.field3 in (select fieldA in tableC); Would anybody know how I can write this so that Hive supports this query (works fine in SQL server) 回答1: Since you do not need fields from tableC , you can use

Hive - Where and OR clause error

守給你的承諾、 提交于 2021-02-08 05:55:48
问题 Hi I am trying to run this query in Hive, but get the error 10249 (Unsupported query expression - only 1 subquery is supported...) select count(*) from ( select * from tableA union all select * from tableB ) a where a.field1 in (select fieldA in tableC) or a.field2 in (select fieldA in tableC) or a.field3 in (select fieldA in tableC); Would anybody know how I can write this so that Hive supports this query (works fine in SQL server) 回答1: Since you do not need fields from tableC , you can use

Oracle subquery funniness

痞子三分冷 提交于 2019-12-29 01:44:26
问题 Imagine a query SELECT Col_A FROM TABLE_A WHERE Col_A IN (SELECT Col_A FROM TABLE_B) Except, TABLE_B does not have a Col_A column; Only TABLE_A has it. I tried this in Oracle 12 and I'm not sure how far back in versions it goes but it looks like is returns a valid result of showing all of Col_A data from TABLE_A. As a developer I'm expecting something like this to throw an error since the inner query does not even access the TABLE_A again so to speak. Can someone explain why or where we would

MySQL: Using “In” with Multiple SubQueries?

限于喜欢 提交于 2019-12-24 09:59:53
问题 I'm trying to use this query: SELECT COUNT(PF.PageID) AS Total,P.PageID FROM Pages P LEFT JOIN Pages_Filters PF ON PF.PageID=P.PageID WHERE P.PageID IN ( (SELECT PageID FROM Pages_Filters WHERE FilterID="1" AND FilterOptionID="2" ), (SELECT PageID FROM Pages_Filters WHERE FilterID="7" AND FilterOptionID="57" ) ) AND P.PageID !="283" GROUP BY PF.PageID Which produces the error: Sub-query returns more than 1 row I'd like for MySQL to merge the results of all the sub-queries, and use values in

Get distinct max date using SQL

馋奶兔 提交于 2019-12-24 07:07:22
问题 I'm not sure quite how to title my question but this is what I'm trying to do: Given pc_tmppl_tbl pc_tmppl_attach pc_tmppl_val1 pc_tmppl_crtdt AJC05-06 AJCINT 2005-08-15 10:32:03.790 AJC06-07 AJCINT 2006-10-17 10:02:06.570 AJC07-08 AJCINT 2007-06-13 10:44:53.573 AJC08-09 AJCINT 2008-06-27 09:51:17.290 AJC09-10 AJCINT 2009-07-20 14:26:06.270 AJC10-11 AJCINT 2010-08-26 11:54:32.777 AJC99-001 AJCINT 2005-05-30 19:30:51.623 ALPI05-06 ALPINE 2005-05-30 19:30:51.623 ALPI07-08 ALPINE 2006-12-11 13

LINQ subquery IN

不羁的心 提交于 2019-12-18 16:51:14
问题 I'm a newbie with the IQueryable, lambda expressions, and LINQ in general. I would like to put a subquery in a where clause like this : Sample code : SELECT * FROM CLIENT c WHERE c.ETAT IN ( SELECT DDV_COLUMN_VAL FROM DATA_DICT_VAL WHERE TBI_TABLE_NAME = 'CLIENT' AND DD_COLUMN_NAME = 'STATUS' AND DDV_COLUMN_VAL_LANG_DSC_1 LIKE ('ac%')) How do I translate this in LINQ ? 回答1: var innerquery = from x in context.DataDictVal where x.TbiTableName == myTableNameVariable && x.DdColumnName == "Status"

MySQL DELETE FROM with subquery as condition

北慕城南 提交于 2019-12-17 02:58:53
问题 I am trying to do a query like this: DELETE FROM term_hierarchy AS th WHERE th.parent = 1015 AND th.tid IN ( SELECT DISTINCT(th1.tid) FROM term_hierarchy AS th1 INNER JOIN term_hierarchy AS th2 ON (th1.tid = th2.tid AND th2.parent != 1015) WHERE th1.parent = 1015 ); As you can probably tell, I want to delete the parent relation to 1015 if the same tid has other parents. However, that yields me a syntax error: You have an error in your SQL syntax; check the manual that corresponds to your

Trying to delete from Join and I know I have funky spacing and I know I have dup IMEI's

自闭症网瘾萝莉.ら 提交于 2019-12-12 18:08:44
问题 DELETE dbo.bBoxDetail FROM dbo.bBoxDetail AS BD INNER JOIN dbo.bBoxHeader AS BH ON LTRIM(RTRIM(BD.bBoxDetailId)) = LTRIM(RTRIM(BH.bBoxId)) WHERE LTRIM(RTRIM(BD.ESNs)) = (SELECT LTRIM(RTRIM(IMEI)) FROM dbo.tmpIMEI) I get this error: Msg 512, Level 16, State 1, Line 1 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. BD.ESNs is NVARCHAR(50) and IMEI is NVARCHAR(30) I have duplicate ESNs and I

What's wrong with this MySQL query? SELECT * AS `x`, how to use x again later?

有些话、适合烂在心里 提交于 2019-12-10 14:49:38
问题 The following MySQL query: select `userID` as uID, (select `siteID` from `users` where `userID` = uID) as `sID`, from `actions` where `sID` in (select `siteID` from `sites` where `foo` = "bar") order by `timestamp` desc limit 100 …returns an error: Unknown column 'sID' in 'IN/ALL/ANY subquery' I don't understand what I'm doing wrong here. The sID thing is not supposed to be a column, but the 'alias' (what is this called?) I created by executing (select siteID from users where userID = uID) as

MySQL DELETE FROM with UNION subquery by IN condition

£可爱£侵袭症+ 提交于 2019-12-02 04:56:09
问题 I have tripped up on a curious SQL error. The last query doesn't work. Of course I can just split that DELETE into three queries, but I really wonder why MySQL doesn't let me do it this way. A little example: (SELECT id FROM stairs WHERE building = 123) UNION (SELECT id FROM lift WHERE building = 123) UNION (SELECT id FROM qrcodeid WHERE building = 123) works! DELETE FROM startpoint WHERE id IN (SELECT id FROM stairs WHERE building = 123) works, too! Whereas DELETE FROM startpoint WHERE id IN