>hi all together!
>
>i'm turning to your mailinglist as last chance to find s.o. helping 
>me with my problem.
>
>the situation is as follows:
>
>i got a table on a mysql-database, queriing it by php4. the table 
>consists of all planets of the planetarion.com-system. these 
>information consists of each 3 coordinates of a planet (x, y and z), 
>identifiing a planet clearly. theese 3 coords are written in a 
>int-field, each. other information are the name of the planet, the 
>rulers name, the score and the size of the planet. when the first 
>two coords (x and y) of 2 planet are equal, the planets belong to 
>the same galaxie. and now the point:

Sir, that means that all the planets of a given galaxy are located on 
a single line (vector). I've heard of disk galaxies, where all the 
objects have the same value (give or take a few million kilometers) 
on one coordinate. Having as few as three planets in just one solar 
system temporarily sharing values on two coordinates has unusual 
results, e.g. three wise men wandering the Middle East on Christmas 
Eve looking for hummus to dip their falafel in.

>i try queriing the database as follows:
>
>the user inserts some wished dates (the lowest score, the searched 
>planet may have, the highest, the highest number of roids and the 
>lowest..) and the number-interval in wich the _galaxy-score_ may be 
>included. (means x > galaxy-sore > y). the problem is, to query 
>that! the first query is very simple: "SELECT * FROM Planetarion 
>WHERE Score > $x AND Score < $y AND Size > $a AND Size < $B". how 
>how you get the galaxie-score for that?? the second query alone is 
>very simple, too: "SELECT SUM(Score) as Summe FROM $table WHERE X = 
>$x AND Y = $y GROUP BY X, Y".
>
>_But how to combine both queries???_
>
>i tried getting the first one and process for each elemnt of it the 
>second one... but then the resources of my server will get low, when 
>the first query results eg. 300 elements or more....
>
>i tried asking the german newsgroup and other people i know, using 
>mysql. and you're my very last hope to solve this problem....
>
>thank you very much for each help!!
>
>regards,
>dotcom

What you are trying to do isn't clear. As written, your queries can't 
be combined. An SQL statement that managed to combine those two 
statements would be comparable to a galaxy in which all the planets 
had the same values on two coordinates; interesting, but too weird to 
avoid falling apart.

However, if you are trying to group the results of the first query 
and sum the scores in each group, the following should work:

    SELECT Sum(Score)
    FROM Planetarion
    WHERE Score > $x AND Score < $y AND Size > $a AND Size < $B
    GROUP BY X, Y;

Bob Hall

**** [EMAIL PROTECTED]
>>>>  Know thyself? Absurd direction!
**** Command 'know' not recognized.
Æsj. Jeg søkte etter en list server og fant en epistemologisk skeptiker.
MySQL secret passwords: sql query database 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to