Actaully i want max(id ) of each item into one select statement
Select item,balance from ACTesting where id =(select max(id) from ACTesting where item='1/2')
Select item,balance from ACTesting where id =(select max(id) from ACTesting where item='2/2')
Select item,balance from ACTesting where id =(select max(id) from ACTesting where item='2/3')

Mayur DigheRank #1,078 · 1.8K reputationPosted Feb 17, 2013, 5:25 AM EST
You can do it..............Just use OR keyword into your SELECT Statement.
e.g.
select item,balance from ACTesting
where id =(select max(id) from ACTesting
where item='1/2' OR item='2/2' OR item='2/3' )
Try....it..., it will Work....
Happy Programming.............
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 17, 2013, 5:59 PM EST
you may also use Union / Union ALL in this case.
Select item,balance from ACTesting where id =(select max(id) from ACTesting where item='1/2')
union all
Select item,balance from ACTesting where id =(select max(id) from ACTesting where item='2/2')
union all
Select item,balance from ACTesting where id =(select max(id) from ACTesting where item='2/3')
also you may got same out put using mayur suggesion by just replacing "=" with "in"
select item,balance from ACTesting
where id in (select max(id) from ACTesting
where item='1/2' OR item='2/2' OR item='2/3' )
hope this will help you.
Gurjeet Singh107 reputationPosted Apr 13, 2013, 11:49 PM EDT