archux Posted March 10, 2007 Report Share Posted March 10, 2007 Nu taa redz man vinjsh tagad njem no vienas DB $result = @mysql_query("SELECT Count(*) FROM ".DB_PREFIX.$table.$cond); kaa es shim varu veel pievienot klat sho SELECT * FROM ".DB_PREFIX."users WHERE user_online='1' ???? nu tipa es gribu lai tas izskatas ta SELECT Count(*) FROM ".DB_PREFIX.$table.$cond + SELECT * FROM ".DB_PREFIX."users WHERE user_online='1' ceru ka saprotami! plz paradat kadu tutoriali vai kaut ko tadu kas man palidzetu, tad es atkodishu! :) Link to comment Share on other sites More sharing options...
andrisp Posted March 10, 2007 Report Share Posted March 10, 2007 Man liekas, ka tev vajag http://dev.mysql.com/doc/refman/5.0/en/union.html Link to comment Share on other sites More sharing options...
archux Posted March 10, 2007 Author Report Share Posted March 10, 2007 (edited) Vai ir veel kaads variants bez UNION ? Edited March 10, 2007 by archux Link to comment Share on other sites More sharing options...
archux Posted March 10, 2007 Author Report Share Posted March 10, 2007 vai ari kur man te ir kljuda $result = @mysql_query(" (SELECT Count".$field." FROM ".DB_PREFIX.$table.$cond.") UNION (SELECT * FROM ".DB_PREFIX."users WHERE user_online=1) "); Link to comment Share on other sites More sharing options...
andrisp Posted March 10, 2007 Report Share Posted March 10, 2007 Lai izmantotu UNION, visiem selektiem jāatgriež tabulas ar vienādu skaitu kollonām. Kā arī: Selected columns listed in corresponding positions of each SELECT statement should have the same data type. Link to comment Share on other sites More sharing options...
archux Posted March 10, 2007 Author Report Share Posted March 10, 2007 hmm a kas tad man ir jaadra man ja paraadiija shaadu The used SELECT statements have a different number of columns Link to comment Share on other sites More sharing options...
Delfins Posted March 10, 2007 Report Share Posted March 10, 2007 Nu bāc... tas ir tāpat, kā "cept ūdeni" vnk izdari 2 selektus atsevišķi... Pat ja tev izdosies uztaisīt tādu selektu, es nemaz neavru iedomāties, ka tu nofetčosi ierakstus... Cita runa, kad ir storētā procedūra, kas atgriež vairākus ResultSet-us Link to comment Share on other sites More sharing options...
andrisp Posted March 10, 2007 Report Share Posted March 10, 2007 Delfins, UNIONētus ierakstus nofetcho kā jebkuru citu rezultsetu. Link to comment Share on other sites More sharing options...
Delfins Posted March 11, 2007 Report Share Posted March 11, 2007 andrisp, pat atšķirās kolonnas? Nejauc UNION ar RecordSet-iem ... Nu vismaz UNION ir viens RecordSet, kurš satur ierakstus no vairākiem SQL, kuri atgriež vienāda tipa RecordSetu (vai kolonnu kolekciju) , ja jau tā abstrakti sauc... Tas ko viņš grib izdarīt - "И рыбку съесть и на х... сесть" Link to comment Share on other sites More sharing options...
archux Posted March 11, 2007 Author Report Share Posted March 11, 2007 :D :D :D vovshem paaratiasiishu db un selektoshu no vienas db taa buus vienkaarshaak un aatraak :) Link to comment Share on other sites More sharing options...
Recommended Posts