You can do this using a bit of a trick for the sub-select

(SELECT MAX(t2.gasday) from daily_data WHERE t2.gasday < t1.gasday)

this will use indexes while (t2.gasday - 1) will not



[EMAIL PROTECTED] wrote:

>RBW6.5++
>
>I am trying to come up with a rule that checks to see if values entered for
>a column todayis less than the value entered in that column for the previous
>day. If it is, it won't allow the change to the table.
>
>this select gets me what I want:
>
>SELECT t1.gasday t1.co2_fuel_counter t2.gasday t2.co2_fuel_counter from
>daily_data t1, +
>daily_data t2 where t1.gasday = t2.gasday-1
>
>But I am having trouble translating this into an actual rule because it
>seems like I want to do a sub-select of some kind but can only accomplish it
>with an IN or NOT IN as opposed to LT...
>
>Thanks!
>Charley
>
>Charles Sikora
>Coordinator Gas Storage
>Manlove Field
>Peoples Energy Corporation
>
>----------------------------------------------------------------
>The information transmitted is intended only for the person
>or entity to which it is addressed and may contain confidential
>and/or privileged material.  Any review, retransmission,
>dissemination or other use of, or taking of any action in reliance
>upon, this information by persons or entities other than the
>intended recipient is prohibited. If you received this in error,
>please contact the sender and delete the material from any computer.
>
>================================================
>TO SEE MESSAGE POSTING GUIDELINES:
>Send a plain text email to [EMAIL PROTECTED]
>In the message body, put just two words: INTRO rbase-l
>================================================
>TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
>In the message body, put just two words: UNSUBSCRIBE rbase-l
>
-- 




__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the 
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l

Reply via email to