Select one column by two different names in the same query I have a table named Main that contains two fields id,name.

I want to select the name column by two different names. For example:

Table Main


id:int, name:varchar(20)


I have inserted the following records:


id  | name 
----+------- 
  1 | Ahmad 
  2 | Sami 


I want to select the data like this:

select Main.name as n1,Main.name as n2 from Main
where n1='Ahmad' and n2='Sami'


When I execute this query, it gives the following error:  


  ERROR:  column "n1" does not exist
  LINE 1: select Main.name n1,Main.name n2 from Main where n1='Ahmad' ...`


I use PostgreSQL as my DBMS.
select n1.name as "n1", n2.name as "n2"
 from main n1, main n2
 where n1.name = 'Ahmad'
     and n2.name = 'Sami';