Question: This is my code:

```
public void playSound(String uri,int flag)
    {
        Uri uri1=Uri.parse(uri);
        ContestVoteFragment fragment = (ContestVoteFragment) fragments.get(0);
        if (fragment.playSound(flag))
        {
            if (mediaPlayer==null)
            {
                mediaPlayer=new MediaPlayer();
                mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                try {
                    mediaPlayer.setDataSource(uri);
                    mediaPlayer.prepare();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                mediaPlayer.start();

            }else {
                mediaPlayer.stop();
                mediaPlayer.reset();
                mediaPlayer.release();
                mediaPlayer=new MediaPlayer();
            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                try {
                    mediaPlayer.setDataSource(uri);
                    mediaPlayer.prepare();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                mediaPlayer.start();
            }
        }else {
            if (mediaPlayer!=null)
            {
                if (mediaPlayer.isPlaying())
                {
                    mediaPlayer.stop();
                }
            }
        }
    }
}

```

But when i play a internet mp3 ,the error message is Couldn't open <http://p9snltngh.bkt.clouddn.com/Fs3M3Cq_Mkex9AsunJt57N22JQp2>: java.io.FileNotFoundException: No content provider
i can’t understand because “<http://p9snltngh.bkt.clouddn.com/FhEbUwGYcmQbXIVMVzd0GyPypDVC>”this uri can play

Answer: 
Assuming you have no gaps in the ranges, I find that in many databases the most efficient method is:

```
select t.*,
       (select top 1 d.discount
        from discounts d
        where t.[$] <= d.[from$]  -- the $ is for whatever column name you actually use
        order by d.[from$] desc
       ) as discount
from t;

```

(Note that this ignores `to$`.)

In particular, this should be able to take advantage of an index on `discounts(from$, discount)`.
We can try using `BETWEEN` here:

```
SELECT
    MAX(IIF(price BETWEEN FROM$ AND TO$, Discount, NULL)) AS Discount
FROM yourTable;

```

We might more typically expect that your table of discounts would store information for multiple groups, e.g. products. In that case, we could write:

```
SELECT
    product,
    MAX(IIF(price BETWEEN FROM$ AND TO$, Discount, NULL)) AS Discount
FROM yourTable
GROUP BY
    product;

```