zintis8789 Posted November 20, 2009 Report Posted November 20, 2009 Vai ir tads mysql kods lidzigs šim bet strādā: SELECT * FROM `kk` WHERE kk='pp' ORDER BY `kautkas`.`'dati1'-'dati2' Man vajag lai jau select logā atņem skaitļus Quote
Aleksejs Posted November 20, 2009 Report Posted November 20, 2009 select (stabins1 - stabins2) AS stabinstarpiba FROM tabula Quote
zintis8789 Posted November 20, 2009 Author Report Posted November 20, 2009 Ja vari uzraksti to kodu kā gatavu sql kodu. Quote
Aleksejs Posted November 20, 2009 Report Posted November 20, 2009 Tas ir gatavs sql kods tabulai ar nosaukumu "tabula", kurā ir šādi divi skaitliski stabiņi "stabins1" un "stabins2". Es nezinu, kāda ir Tevi interesējošās tabulas struktūra. Quote
zintis8789 Posted November 20, 2009 Author Report Posted November 20, 2009 Nu man ir šāds php kods: $sql="SELECT SQL_CALC_FOUND_ROWS * FROM `stati` WHERE pos='Goalie' ORDER BY `stati`.`PPG` DESC LIMIT 0, 30 "; Un man vajag izvilt no datubazes: S - PPG Quote
Aleksejs Posted November 20, 2009 Report Posted November 20, 2009 $sql="SELECT SQL_CALC_FOUND_ROWS, (S - PPG) AS Starpiba, visa, parejas, vajadzigas, kolonnas FROM `stati` WHERE pos='Goalie' ORDER BY `stati`.`PPG` DESC LIMIT 0, 30 "; Quote
zintis8789 Posted November 20, 2009 Author Report Posted November 20, 2009 (edited) AA nekas tiko izlaboju kļūdu :D Edited November 20, 2009 by zintis8789 Quote
Val Posted November 20, 2009 Report Posted November 20, 2009 atver manuāli un izlasi pareizo variantu. Quote
zintis8789 Posted November 20, 2009 Author Report Posted November 20, 2009 Manuāli nav rakstīts kaa var tagad var sakartot. ORDER BY `stati`.`(`S` - `PPG`) AS `Starpiba` Ierakstu tadu kodu met uzreiz erroru: 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 'S` - `PPG`) AS `Starpiba` DESC LIMIT 0, 30' at line 1 Quote
xPtv45z Posted November 20, 2009 Report Posted November 20, 2009 Izlasi manualī ko šis nozīmē - "`stati`." Quote
Gints Plivna Posted November 20, 2009 Report Posted November 20, 2009 Manuāli nav rakstīts kaa var tagad var sakartot. ORDER BY `stati`.`(`S` - `PPG`) AS `Starpiba` Ja nu, lai cik tas nebūtu dīvaini, manuāļos nav rakstīts par katru konkrēto gadījumu, kas rodas izstrādes procesā. Baigi besīgi, protams, es piekrītu. Bet vispār jau klīst runas, ka cilvēkiem esot, piemēram, tādas spējas kā lietot analoģiju, un tad visus iespējamos bezgalīgi daudzos variantus manuālī var neuzskaitīt... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.