20-11-2006, 12:14 PM
Bon alors il n'y a plus que le NOT IN.
Le MINUS aurait été parfait pour ce cas là.
Le MINUS aurait été parfait pour ce cas là.
Code PHP :
<?php
INSERT INTO tbl_planete_tmp( coordonnee_x, coordonnee_y )
SELECT DISTINCT `x` , `y`
FROM `tbl_planete_ref`
WHERE `x` NOT IN(
SELECT DISTINCT `x`
FROM `tbl_planete_ref` , `tbl_planete`
WHERE `tbl_planete`.`galaxie` =1
AND
(
`tbl_planete_ref`.`x` - `tbl_planete`.`coordonnee_x`
)
*
( `tbl_planete_ref`.`x` - `tbl_planete`.`coordonnee_x` )
+
( `tbl_planete_ref`.`y` - `tbl_planete`.`coordonnee_y` )
*
( `tbl_planete_ref`.`y` - `tbl_planete`.`coordonnee_y` )
<= ( `tbl_planete`.`taille` +5 ) * ( `tbl_planete`.`taille` +5 ))
AND
`y` NOT IN(
SELECT DISTINCT `y`
FROM `tbl_planete_ref` , `tbl_planete`
WHERE `tbl_planete`.`galaxie` =1
AND
(
`tbl_planete_ref`.`x` - `tbl_planete`.`coordonnee_x`
)
*
( `tbl_planete_ref`.`x` - `tbl_planete`.`coordonnee_x` )
+
( `tbl_planete_ref`.`y` - `tbl_planete`.`coordonnee_y` )
*
( `tbl_planete_ref`.`y` - `tbl_planete`.`coordonnee_y` )
<= ( `tbl_planete`.`taille` +5 ) * ( `tbl_planete`.`taille` +5 ))