2017-01-04 15 views
0

に2つの列を比較するために、LIKEを使用して、次のように私は2つのSPARKのSQLテーブルを持って、SPARKのSQL

Table 1

email   | client_ip | travelling_method | travelling_code 
[email protected] |203.22.22.22 | Car    | car001 
[email protected] |203.22.22.22 | Jeep    | jeep001    

Table 2

email   | client_ip | account_type | trav_code 
[email protected] |203.22.22.22 | true   | car 
[email protected] |203.22.22.22 | false   | jeep 

My query is as follows,

SELECT table1.email, table1.client_ip, table1.travelling_method, table1.travelling_code, table2.account_type FROM table1 LEFT JOIN table2 ON table1.email = table2.email AND table1.client_ip = table2.client_ip AND table1.travelling_code LIKE CONCAT('%' ,table2.trav_code, '%') WHERE table1.email = '[email protected]'; 

私が取得する上記のクエリを書きました次の出力が、例外で私をスローします。

所望の出力は次のようになります。誰かが私のクエリで行方不明何イムを私に指摘して私を助けることができれば

email   | client_ip | travelling_method | travelling_code| account_type 
[email protected] |203.22.22.22 | Car    | car001   | true 
[email protected] |203.22.22.22 | Jeep    | jeep001  | false 

は感謝しています。 :)

+0

エラースタックをもう1つ追加できますか? –

答えて

0

SELECT table1.email, table1.client_ip, table1.travelling_method, table1.travelling_code, table2.account_type 
FROM table1 LEFT JOIN table2 ON table1.email = table2.email WHERE 
table1.client_ip = table2.client_ip 
AND table1.travelling_code LIKE CONCAT('%' ,table2.trav_code, '%') and table1.email = '[email protected]' 

などの適切な場所に、私はあなたのクエリをテストしていない「どこで」書いてみてください。それでもエラーが続く場合は、エラーメッセージとともに投稿してください。

+0

クエリを試しましたが、引き続きエラーをスローし続けます:AnalyticsProcessorAdminServiceAnalyticsProcessorAdminExceptionException。 –