Reply to Re: Selecting records with equal vectors

Your name:

Reply:


Posted by strawberry on 03/19/07 14:34

On Mar 19, 1:41 pm, "Dr. Wolfgang Hintze" <w...@snafu.de> wrote:
> Suppose we have a table tab ín which there are fields X, Y, ...
> which designate the coordinates of n-dimensional vectors.
>
> We would like to select all records which contain the same vectors
>
> Exapmple n=2
>
> ID X Y
> 01 1 2
> 02 1 3
> 03 1 2
> 04 2 3
>
> The select statement should yield the records with ID 01 and 03
> (vectors (1,2))
>
> There might of course be several sets of equal vector records.
>
> In the end we would like to have a list of all those equal vector
> records.
>
> In my practical case n=2 is sufficient but a general formulation would
> be interesting as well.
>
> Any help and suggestions would be greatly appreciated.
>
> Wolfgang

Sorry, I don't understand the implications of n in this problem...

SELECT DISTINCT (v1.id), v2.x, v2.y
FROM vectors v1
LEFT JOIN vectors v2 ON v1.id <> v2.id
WHERE v1.x = v2.x
AND v1.y = v2.y
ORDER BY v1.x, v1.y, v1.id
;

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация