I want to select data from ranges like

Column1 Column2
25000 10
50000 20
75000 30

I want records like upto 25000, I get 10
upto 50000, I get 20
upto or more than 75000, I get 30

Can anybody suggest me a simple query for that?

Thanks in advance,

Recommended Answers

All 2 Replies

You could use

select Column2
	from table1 t
	where Column1 = ( select min ( Column1	 )
				from table1 ta
				where ta.Column1 > [I]NumberRequired[/I]);

Nige

I want to select data from ranges like

Column1 Column2
25000 10
50000 20
75000 30

I want records like upto 25000, I get 10
upto 50000, I get 20
upto or more than 75000, I get 30

Can anybody suggest me a simple query for that?

Thanks in advance,

hello make the question more clear. As per as I understood the ans was
select column1, column2 from table1 order by column2
If u want the ranges give
select column1, column2 from table1 where Column1<= 25000 and Column1 >= 50000

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.