multiple 'between's'

  • hey there,

    I have yet another problem. I have to display several data between 1500 and 1598 and also data between 3500 and 3599 and also data between 3900 and 3999.

    how do i select the data with so many between's???

    hope you could help

    eat when you can and not when you cannot.


    eat when you can and not when you cannot.

  • Try this:

    select <col1>, <col2>

    from <table_name>

    where ( <col1> between 1500 and 1598 or <col1> between 3500 and 3599 or <col1> between 3900 and 3999 )

    and .... /* Other where clause statements */

    NB Put the between statements in brackets otherwise you might get strange results if you have other parts to your where clause.

    Jeremy

  • Thank you so much.....this codes helped alot.

    eat when you can and not when you cannot.


    eat when you can and not when you cannot.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply