Jump to content
php.lv forumi

Vjadzētu palīdzību ar skolas uzdevumu


Recommended Posts

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:

 

post-3589-126377161851_thumb.jpg

 

Paldies par palīdzību

Link to post
Share on other sites

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);

Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...