You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by hager sallah <lo...@yahoo.com.INVALID> on 2015/05/05 18:01:23 UTC

how can implemented subquery in flink

  how can implemented subquery in flinkexample
SELECT C_CUSTKEY,C_NAME
FROM Customers where C_MKTSEGMENT=(select C_CUSTKEY,C_MKTSEGMENT from Customers where C_ADDRESS="MG9kdTD2WBHm")     




Re: how can implemented subquery in flink

Posted by hager sallah <lo...@yahoo.com.INVALID>.
>From Customers AS c1, Customers AS c2
 this is two dataset how can use filter function implemented this


     On Tuesday, May 5, 2015 9:30 AM, Matthias J. Sax <mj...@informatik.hu-berlin.de> wrote:
   

 If the sub-query is not correlated, you can (always) transform it into a
simple join query.

However, the query you show is no valid SQL... Did you mean:

SELECT C_CUSTKEY,C_NAME
FROM Customers
WHERE C_MKTSEGMENT =
  (SELECT C_MKTSEGMENT FROM Customers WHERE C_ADDRESS="MG9kdTD2WBHm")

In this case, you can transform it into:

SELECT c1.C_CUSTKEY, c1.C_NAME
FROM Customers AS c1, Customers AS c2
WHERE c1.C_MKTSEGMENT = c2.C_MKTSEGMENT
      AND c2.C_ADDRESS="MG9kdTD2WBHm"


-Matthias



On 05/05/2015 06:01 PM, hager sallah wrote:
>  how can implemented subquery in flinkexample
> SELECT C_CUSTKEY,C_NAME
> FROM Customers where C_MKTSEGMENT=(select C_CUSTKEY,C_MKTSEGMENT from Customers where C_ADDRESS="MG9kdTD2WBHm")    
> 
> 
> 
> 


  

Re: how can implemented subquery in flink

Posted by "Matthias J. Sax" <mj...@informatik.hu-berlin.de>.
If the sub-query is not correlated, you can (always) transform it into a
simple join query.

However, the query you show is no valid SQL... Did you mean:

SELECT C_CUSTKEY,C_NAME
FROM Customers
WHERE C_MKTSEGMENT =
  (SELECT C_MKTSEGMENT FROM Customers WHERE C_ADDRESS="MG9kdTD2WBHm")

In this case, you can transform it into:

SELECT c1.C_CUSTKEY, c1.C_NAME
FROM Customers AS c1, Customers AS c2
WHERE c1.C_MKTSEGMENT = c2.C_MKTSEGMENT
      AND c2.C_ADDRESS="MG9kdTD2WBHm"


-Matthias



On 05/05/2015 06:01 PM, hager sallah wrote:
>   how can implemented subquery in flinkexample
> SELECT C_CUSTKEY,C_NAME
> FROM Customers where C_MKTSEGMENT=(select C_CUSTKEY,C_MKTSEGMENT from Customers where C_ADDRESS="MG9kdTD2WBHm")     
> 
> 
> 
>