JazMan Posted July 6, 2005 Report Share Posted July 6, 2005 Sakot ar kuru My SQL versiju var izmantot sub selektus piem "delete from ratings where wallpaperid in (select wallpaperid from wallpaper where galleryid = $gallid)" Link to comment Share on other sites More sharing options...
Kristabs Posted July 6, 2005 Report Share Posted July 6, 2005 Sakot ar kuru My SQL versiju var izmantot sub selektus piem "delete from ratings where wallpaperid in (select wallpaperid from wallpaper where galleryid = $gallid)" 19102[/snapback] Subqueries Add Advanced Querying Capabilities MySQL Version 4.1 will include support for SQL subqueries, also called subselects or nested queries, a powerful feature that lets users search complex data with ease and efficiency. http://www.mysql.com/news-and-events/press...se_2003_07.html Link to comment Share on other sites More sharing options...
JazMan Posted July 6, 2005 Author Report Share Posted July 6, 2005 Blin, naksies kaut ka savadak izgrozities man stav vecaka versija :( Link to comment Share on other sites More sharing options...
bubu Posted July 6, 2005 Report Share Posted July 6, 2005 Tam kverijam jau nevajag subselektu! DELETE ratings USING wallpaper WHERE wallpaper.wallpaperid = ratings.wallpaperid AND wallpaper.galleryid = $gallid Link to comment Share on other sites More sharing options...
des Posted July 6, 2005 Report Share Posted July 6, 2005 Tam kverijam jau nevajag subselektu! DELETE ratings USING wallpaper WHERE wallpaper.wallpaperid = ratings.wallpaperid AND wallpaper.galleryid = $gallid 19107[/snapback] hmm, shitaadu delete versiju liidz shim nebiju izmantojis. kaadreiz iespeejams noderees. thanx :) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 6, 2005 Report Share Posted July 6, 2005 Tam kverijam jau nevajag subselektu! DELETE ratings USING wallpaper WHERE wallpaper.wallpaperid = ratings.wallpaperid AND wallpaper.galleryid = $gallid 19107[/snapback] tieshi taa :) apmeeram 50-80% gadijumu var izmantot shadu pierakstu pat aizvietojot 3 un vairaak iekseejos subselectus :) papildus vienai un tai pashai tabulai var pieskirt dazaadus nosaukumus un izmantot taas kaa divas dazaadas tabulas :) P.S. teiksim kad vajag selekteet no tabulas ailes kaadu kaudziiti datu no tiem atlasiit vel dalju un tad tikai dabuut gala rez (teoretiski 2 iekseejie subselekti)... Link to comment Share on other sites More sharing options...
PheliX Posted July 6, 2005 Report Share Posted July 6, 2005 http://dev.mysql.com/doc/mysql/en/rewriting-subqueries.html Link to comment Share on other sites More sharing options...
JazMan Posted July 6, 2005 Author Report Share Posted July 6, 2005 Man tas variants ar Using nestradaa :( Link to comment Share on other sites More sharing options...
bubu Posted July 7, 2005 Report Share Posted July 7, 2005 Varēji vismaz patiekt, kas nestrādā! (mysql_error). Pamēģini šādi, laikam aizmirsu FROM uzlikt: DELETE FROM ratings USING wallpaper WHERE wallpaper.wallpaperid = ratings.wallpaperid AND wallpaper.galleryid = $gallid (USING vietā var lietot arī FROM keywordu) Link to comment Share on other sites More sharing options...
JazMan Posted July 7, 2005 Author Report Share Posted July 7, 2005 Taa jau arii megjinaju, met kljudu: Not unique table/alias: 'ratings' Link to comment Share on other sites More sharing options...
JazMan Posted July 7, 2005 Author Report Share Posted July 7, 2005 vajadzeja taaa: DELETE FROM ratings USING wallpaper, ratings WHERE wallpaper.wallpaperid = ratings.wallpaperid AND wallpaper.galleryid = $gallid Link to comment Share on other sites More sharing options...
JazMan Posted July 7, 2005 Author Report Share Posted July 7, 2005 Baigi labais veids kaa iztikt bez sub selektiem, ieprieksh tadu nebiju izmantojis ;) Link to comment Share on other sites More sharing options...
bubu Posted July 7, 2005 Report Share Posted July 7, 2005 ahh, nu pareiz, tur ar tabulu vajdzēj :) Šis jau ļoti normāls veids. Bez subselektiem daudzkur var iztikt, tikai labi jāpārzin JOIN'u veidošana, tad daudz lietas var izdarīt (nu bet protams ne visas, kuras ar subselektiem). Link to comment Share on other sites More sharing options...
Recommended Posts