Jump to content

Selection problem, all data is corect


ebchost

Recommended Posts

$utakmice = mysql_query("
SELECT 
`man_timovi`.`id`, 
`man_timovi`.`naizv`, 
`man_timovi`.`user_id`, 
`man_utakmice`.`id`,
`man_utakmice`.`liga_id`, 
`man_utakmice`.`sezona_id`, 
`man_utakmice`.`kolo`, 
`man_utakmice`.`datum,
`man_utakmice`.`domacin`, 
`man_utakmice`.`brojd`, 
`man_utakmice`.`gold`, 
`man_utakmice`.`golg`, 
`man_utakmice`.`brojg`, 
`man_utakmice`.`gost`, 
SUM(`man_utakmice`.`bodd` + `man_utakmice`.`bodg`)

FROM `man_timovi`,`man_utakmice` 

WHERE `man_utakmice`.`liga_id`= '1' AND `man_timovi`.`id` = `man_utakmice`.`domacin` OR `man_timovi`.`id`=`man_utakmice`.`gost`

GROUP BY `man_timovi`.`id`

ORDER BY SUM(`man_utakmice`.`bodd`+`man_utakmice`.`bodg`) DESC") or die(mysql_error());

while($row = mysql_fetch_array($utakmice))
{
..
}

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`.`domacin`, `man_utakmice`.`brojd`, `man_utakmice`.`gold`, `man_utakmice`.`g' at line 9

 

man_timovi:

id, liga_id, naziv, user_id berger, sifra

 

man_utakmice:

id, liga_id, sezona_id, kolo, datum, domacin, brojd, gold , golg, brojg, gost, bodd, bodg

 

 

Link to comment
Share on other sites

Your kidding aren't you?

 

i mast write SQL with out ``

 

thanks

 

Pardon?

 

SELECT 
man_timovi.id, 
man_timovi.naziv, 
man_timovi.liga_id,  
SUM( gold ) , SUM( golg ) , SUM( bodd ) , SUM( bodg ) 
FROM man_timovi, man_utakmice
WHERE man_timovi.liga_id = '1'
AND man_timovi.id = man_utakmice.domacin
OR man_timovi.id = man_utakmice.gost
GROUP BY  man_timovi.id 
ORDER BY SUM(  `man_utakmice`.`bodd` +  `man_utakmice`.`bodg` ) DESC 

 

the only thing bothering me now is, which is still showing data for the league labeled liga=2, liga=3 .. I want only league 1 (liga_id = 1)

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.