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

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top