Scott Klarenbach wrote: >Is there a way to represent infinity in mysql? > >I've got a range field in my GUI, which is "> x"... > >if the user chooses this field, in the DB, I store it as: > >id | from | to | other >2 | x | infinity | etc... > >this is because there are situations of "< x" and "between x AND y", >so from and to is the easiest way to store it... > >I could make infinity default to 100,000,000 or some other number I >know will never be reached, but it seems less elegant a solution... > > If the user enters infinity, store a NULL value in the field. In your code, if you detect a NULL value, don't use a limit. ie don't say 'between x and y', but instead say something like:
where some_field > x and some_field < y in the case where there are 2 values, or: where some_field > x in the case where a NULL value is detected in y, or: where some_field < y in the case where a NULL value is detected in x -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]