0

私は userStream を持っていますusername,ipaddress,timestamp

UserDetailsTableこの詳細を(メモリ内テーブルに)保存したいので、 upsertを実行する必要があります。ユーザー名と ipaddress が同じ場合に行を更新し、それ以外の場合は新しい行として挿入するにはどうすればよいでしょうか。

例えば:

Ist userStream is "Rockey","192.15.12.11","10-10-2015 10.32"
2nd userStream is "Jose","192.15.12.21","10-10-2015 10.33"
3rd userStream is "Rockey","192.15.12.11","10-10-2015 10.34"

UserDetailsTable の結果は以下のとおりです

"Jose","192.15.12.21","10-10-2015 10.33"   (New row)
"Rockey","192.15.12.11","10-10-2015 10.34" (Update the existing row)
4

1 に答える 1

0

次の方法を使用できます。

from userStream
select username, ipaddress ,timestamp
update UserDetailsTable
on UserDetailsTable.username == username

ストリーム属性とイベント テーブル属性は同じである必要があることに注意してください。お役に立てれば。

ありがとう。

于 2015-05-12T02:58:00.253 に答える