Question

can you assign an alias to the from clause? like:

select a - b "Markup" from retail a, cost b;

EDIT: sorry i typed that out a bit too quick and tried to simplify the question to the point where it didnt make any sense

What im actually trying to do is use aliases to compare the months between two publishing dates in the same table. Here's what i found works:

select distinct to_char(months_between((select distinct pubdate
                                        from books3 
                                        where pubid = 2), 
                                       (select distinct pubdate 
                                        from books3 
                                        where pubid = 4)), '99.99') "Answer"
                              from books3

i wanted it to looks something like this:

select distinct months_between(a,b)
from (select distinct pubdate 
       from books3 
       where pubid = 2 as a), 
     (select distinct pubdate 
      from books3 
      where pubid = 4 as b)

but that isn't working

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top