Search code examples
sqloracle-databaseoracle12c

How to select tuple from rows in oracle


I have temp table that has following values:

╔═══════════╤═══════════╗
║ LATITUDE  │ LONGITUDE ║
╠═══════════╪═══════════╣
║ 69.122112 │ 39.122112 ║
╟───────────┼───────────╢
║ 69.123450 │ 39.123450 ║
╚═══════════╧═══════════╝

I want to do something like this

with temp as (select LATITUDE,LONGITUDE from SOME_TABLE_B)
select * from temp
union
select LATITUDE,LONGITUDE from SOME_TABLE where (LATITUDE, LONGITUDE) in (select (LATITUDE, LONGITUDE) from temp)

So as to select all other data that has similar latitude and longitude pair. But I get the following result:

ORA-00920 invalid relational operator

How can I select tuple from table, to use IN CLAUSE with tuple?

Thanks is advance


Solution

  • I think the issue is the additional parentheses in the subquery. Try this:

    select LATITUDE,LONGITUDE
    from SOME_TABLE
    where (LATITUDE, LONGITUDE) in (select LATITUDE, LONGITUDE from temp)