Search Postgresql Archives

Re: Query regarding Intersect clause

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ajit Pradnyavant <ajit.pradnyavant@xxxxxxxxx> writes:
> I think result of INTERSECT ALL query may be :

> Srno	Name
> 1	Aaaa
> 1	Aaaa

> Because  intersect all clause returns the duplicate values.

No; per the documentation at
http://www.postgresql.org/docs/9.1/static/sql-select.html#SQL-INTERSECT

	The result of INTERSECT does not contain any duplicate rows unless the
	ALL option is specified. With ALL, a row that has m duplicates in the
	left table and n duplicates in the right table will appear min(m,n)
	times in the result set.

So a single instance of Aaaa is appropriate for your example.  (This
definition is per the SQL standard btw.)

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux