Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to include dual table in a join query

Tags:

sql

oracle

Is it possible to include the DUAL table in a join query ?

Can anyone give me an example which includes the SYSTIMESTAMP from dual table.

like image 570
rktimeless Avatar asked Oct 15 '12 11:10

rktimeless


1 Answers

One common use (for me) is to use it to make inline views to join on...

SELECT
  filter.Title,
  book.*
FROM
(
  SELECT 'Red Riding Hood'  AS title FROM dual
  UNION ALL
  SELECT 'Snow White'       AS title FROM dual
)
  AS filter
INNER JOIN
  book
    ON book.title = filter.title

[This is a deliberately trivialised example.]

like image 60
MatBailie Avatar answered Nov 03 '22 11:11

MatBailie