<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1024765" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1024765</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/looking-simpler-solution#comment-1151396</link>
    <description> &lt;p&gt;Yes, Mark&#039;s idea is good. Also, to calculate the number of days between a given day and the end of the month in mySQL you can use what&#039;s in mySQL Cookbook in Recipe 5.22&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT d,&lt;br /&gt;DAYOFMONTH(DATE_SUB(&lt;br /&gt;DATE_ADD(DATE_SUB(d,INTERVAL DAYOFMONTH(d)-1 DAY), INTERVAL 1 MONTH),&lt;br /&gt;INTERVAL 1 DAY))&lt;br /&gt;AS &amp;#039;days in month&amp;#039;&lt;br /&gt;FROM date_val;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Fri, 14 May 2004 01:13:11 +0000</pubDate>
 <dc:creator>eBlush_Hector</dc:creator>
 <guid isPermaLink="false">comment 1151396 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/looking-simpler-solution#comment-1151386</link>
    <description> &lt;p&gt;Unless there is a way to calculate the number of days between April 23 and the end of the month.  I don&#039;t know of a way off the top of my head (in sql).&lt;/p&gt;
&lt;p&gt;Inserting a record for the begining (and maybe end) of the month may be the easiest solution.&lt;/p&gt;
 </description>
     <pubDate>Thu, 13 May 2004 23:53:56 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1151386 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/looking-simpler-solution#comment-1151356</link>
    <description> &lt;p&gt;Mark, I like your idea, would save on the tons of &quot;inserts&quot; for each day they didn&#039;t save anything in my approach. The only trick still remaining is then finding it for just one month, and say they didn&#039;t do an update from 4-23 until 5-3. &lt;/p&gt;
&lt;p&gt;Maybe when it has an update, just do an insert of a record for the begining of each month?&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Thu, 13 May 2004 16:03:16 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1151356 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/looking-simpler-solution#comment-1151311</link>
    <description> &lt;p&gt;I would advise use of a history table...&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;+----+--------+-------------+--------------+-----------------+&lt;br /&gt;| id | client | change_date | change_value | change_duration |&lt;br /&gt;+----+--------+-------------+--------------+-----------------+&lt;br /&gt;|&amp;nbsp; 1 |&amp;nbsp;&amp;nbsp;&amp;nbsp; 123 | 2004-05-01&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5000 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4 |&lt;br /&gt;|&amp;nbsp; 2 |&amp;nbsp;&amp;nbsp;&amp;nbsp; 123 | 2004-05-05&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6500 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7 |&lt;br /&gt;|&amp;nbsp; 3 |&amp;nbsp;&amp;nbsp;&amp;nbsp; 123 | 2004-05-12&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7000 |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 |&lt;br /&gt;+----+--------+-------------+--------------+-----------------+&lt;/code&gt;&lt;/div&gt;&#039;If change_duration is zero, then change_value is the currently effective value.  When the user changes the value, run an update to calculate the duration for the last value and update the previous record. Then insert a new row with the new value and the days date.&lt;/p&gt;
&lt;p&gt;Using PHP (or ASP), query the table for dates required, then perform your math:&lt;br /&gt;
change_value * change_duration / SUM(change_duration)&lt;/p&gt;
 </description>
     <pubDate>Thu, 13 May 2004 00:15:32 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1151311 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/looking-simpler-solution#comment-1151284</link>
    <description> &lt;p&gt;It is much easier to do inserts and let the DB do the calcs, but I do not think the speed difference between your function and the DB calc will be too different. However, if you say the value may not change for weeks or months, then your function would prolly be more efficient, since you&#039;ll be taking shortcuts the DB cannot.&lt;/p&gt;
&lt;p&gt;If development time is more precious right now, then let the DB do the calcs and create an optimized function later in the life of the project.... &quot;hopefully if things go well&quot;&lt;/p&gt;
 </description>
     <pubDate>Wed, 12 May 2004 18:20:46 +0000</pubDate>
 <dc:creator>eBlush_Hector</dc:creator>
 <guid isPermaLink="false">comment 1151284 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
