About 169,000 results
Open links in new tab
  1. sql - Can I use CASE statement in a JOIN condition ... - Stack …

    Apr 21, 2012 · A CASE expression returns a value from the THEN portion of the clause. You could use it thusly: SELECT * FROM sys.indexes i JOIN sys.partitions p ON i.index_id = p.index_id JOIN sys.allocation_units a ON CASE WHEN a.type IN (1, 3) AND a.container_id = p.hobt_id THEN 1 WHEN a.type IN (2) AND a.container_id = p.partition_id THEN 1 ELSE 0 …

  2. Joining Tables in Oracle SQL Developer - Stack Overflow

    Jun 21, 2013 · It works in Oracle as it would in other DB engines : SELECT * FROM JNL1 j1 INNER JOIN JNL2 j2 ON j1.ItemID = j2.ItemID INNER JOIN JNL3 j3 ON j1.ItemID = j3.ItemID INNER JOIN JNL4 j4 ON j1.ItemID = j4.ItemID One typical Oracle syntax exists when you want to LEFT JOIN: Standard SQL:

  3. SQL Inner join on select statements - Stack Overflow

    Mar 28, 2011 · I am trying to make an inner join on a select statement like this: select * from (select* from bars where rownum <= 10 )as tab1 inner join (select * from bars where rownum <= 10 )as tab2 on tab1.close=tab2.close and I get the following error: ORA-00933 SQL command not properly ended Any help would be appreciated, thank you!

  4. sql - Update statement with inner join on Oracle - Stack Overflow

    Mar 15, 2010 · UPDATE (SELECT table1.value as OLD, table2.CODE as NEW FROM table1 INNER JOIN table2 ON table1.value = table2.DESC WHERE table1.UPDATETYPE='blah' ) t SET t.OLD = t.NEW It depends if the inline view is considered updateable by Oracle ( To be updatable for the second statement depends on some rules listed here).

  5. sql - Oracle " (+)" Operator - Stack Overflow

    Oct 26, 2010 · Oracle recommends that you use the FROM clause OUTER JOIN syntax rather than the Oracle join operator. Outer join queries that use the Oracle join operator (+) are subject to the following rules and restrictions, which do not …

  6. Oracle SQL Conditional Outer Join using case statement

    Apr 2, 2013 · You can put your CASE in the SELECT clause and join the tables accordingly, like this:. SELECT CASE WHEN tb.tableAID IS NOTNULL THEN tab.desc ELSE tac.desc END AS desc -- or better: NVL(tab.desc, tac.desc) AS desc , tc.start_date , tc.end_date FROM tableC tc JOIN tableB tb ON tc.tableBID = tb.tableBID LEFT JOIN tableA tab ON tab.tableAID = tb.tableAID LEFT JOIN tableA tac ON tac.tableAID = tc ...

  7. Conditional joining in oracle sql with if else or not

    Aug 13, 2017 · you can use case when statement. select case when a.sls_cont_no is not null then (select distinct m.name from gl b join sales_cont sls on b.sls_cont_no = sls.sls_cont_no join marketer m on m.mktrinit = sls.mktrinit where b.invno = '67883' and b.cust_id = '14714') else (select distinct m.name from gl c join tank ta on c.dest_tank = ta.tank_no join marketer m on m.mktrinit = ta.mktrinit where c ...

  8. sql - How to use oracle outer join with a filter where clause - Stack ...

    Nov 16, 2015 · A LEFT OUTER JOIN is one of the JOIN operations that allow you to specify a join clause. It preserves the unmatched rows from the first (left) table, joining them with a NULL row in the shape of the second (right) table. So you can do as follows : SELECT FROM a LEFT OUTER JOIN b ON a.id = b.id

  9. sql - Oracle INNER JOIN ON CASE WHEN condition - Stack Overflow

    Aug 26, 2020 · I have two subqueries I need to (inner) join on a column ("id"). Unfortunately, some of the values I am joining on have been altered somewhere before, so the ON condition of the INNER JOIN is supposed to be conditionally selected out of two, depending on the value of another column ("discriminator"). A simplified example follows:

  10. sql - How can I join two SELECT statements? - Stack Overflow

    Jan 29, 2012 · JOIN two SELECT statement results from two different tables. 1. Joining two queries together in Oracle SQL. 0.

Refresh