genau Posted January 17, 2010 Report Share Posted January 17, 2010 Sveiki, nekādi netieku nskaidrībā ar selektu ikš funkcijas kam būtu jāatlasa cik % no īpašumiem lietotāja definētā laika posmā ir mainījuši īpašniekus. mans selekts ir šāds : SELECT ROUND(count(IV.ZemesID)/(count(Z.ZemesID)-1) * 100, 2)AS Procenti FROM IpasniekaVesture IV INNER JOIN Zeme Z ON IV.ZemesID = Z.ZemesID where IV.ZemesID IN (SELECT ZemesID FROM IpasniekaVesture IV group by IV.ZemesID Having count(IV.ZemesID)>1)AND (@Datums1>IV.DatumsNo AND IV.DatumsLidz<@Datums2) ER: Paldies par palīdzību Quote Link to comment Share on other sites More sharing options...
2easy Posted January 18, 2010 Report Share Posted January 18, 2010 tev skola ir Valsts Zemes Dienestā? echo round(mysql_num_rows(mysql_query('SELECT COUNT(*) AS Cnt FROM IpasniekaVesture WHERE sākuma-datums BETWEEN DatumsNo AND DatumsLidz OR beigu-datums BETWEEN DatumsNo AND DatumsLidz GROUP BY ZemesID HAVING Cnt > 1')) / mysql_num_rows(mysql_query('SELECT COUNT(*) FROM IpasniekaVesture WHERE sākuma-datums BETWEEN DatumsNo AND DatumsLidz OR beigu-datums BETWEEN DatumsNo AND DatumsLidz GROUP BY ZemesID')) * 100); Quote Link to comment Share on other sites More sharing options...
genau Posted January 18, 2010 Author Report Share Posted January 18, 2010 (edited) Nē, skolas uzdevums saucās zemes dienests, paldies par palīdzību! Bet mani vairāk interisē tas kā to norealizēt tikai ar sql Edited January 18, 2010 by genau Quote Link to comment Share on other sites More sharing options...
2easy Posted January 18, 2010 Report Share Posted January 18, 2010 tad jau laikam jāizdala divi subselektu rezultāti un jāreizina ar 100 turpat iekš sql Quote Link to comment Share on other sites More sharing options...
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.