2014-02-05 2 views
-1

select MAX(index_no) from Checkin_master을 적용했습니다.android에서 sqlite 데이터베이스의 최대 개수 가져 오기

커서가 int 값을 얻고 있습니다. 하지만 난 integer.my 코드에서 그 값을 저장하는 방법을 몰라 다음과 같습니다.

Cursor c=db.rawQuery("select MAX(index_no) from CheckIN_master",null); 
     if(c!=null){ 
      while(c.moveToNext()) 
      { 
       in_no=c. 
      } 
     } 

도와주세요.

+2

SELECT * 사용해 WHERE ID = (TABLE FROM MAX (ID)를 선택); –

답변

0

테이블이 하나

Cursor c=db.rawQuery("select MAX(index_no) as MAX_NO from CheckIN_master",null); 
    if(c!=null){ 
     while(c.moveToNext()) 
     { 
      in_no=c.getInt(c.getColumnIndex("MAX_NO")); 
     } 
    } 
관련 문제