Select Query Problem (Urgent)

Put your problem here if it does not fit any of the other categories.

Select Query Problem (Urgent)

Postby zeeshan » Fri Mar 28, 2008 4:05 pm

String[] selectionArgs = {Coupon.PRIMARY_KEY + "=" + couponPrimayKey};
try {
couponDBHelper.openDatabase();
Cursor c = couponDBHelper.fetchRow(
InitializeConfiguration.COUPON_TABLE, false, null,
//Coupon.PRIMARY_KEY + "=" + couponPrimayKey,selectionArgs,null,
Coupon.POI_CATEGORY_LISTING_ID + "=" + poid,selectionArgs,null,
//Coupon.POI_CATEGORY_LISTING_ID + "=" + poid
null, null);

i want to get the row where like this

select * from coupon where coupon.PRIMARY_KEY = 1 and Coupon.POI_CATEGORY_LISTING_ID = 2

how can i achived this from above code please help me out
zeeshan
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Mar 03, 2008 6:10 am

Top

confused

Postby cadlg » Fri Mar 28, 2008 4:49 pm

sorry zeeshan, I'm a bit confused...

what class is couponDBHelper an instance of ? :?
cadlg
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Feb 20, 2008 12:33 am
Location: Guatemala

Postby zeeshan » Mon Mar 31, 2008 6:52 am

its just a wrapper couponDBHelper

which handles all update select statemtns


please help me out
zeeshan
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Mar 03, 2008 6:10 am

Postby zeeshan » Mon Mar 31, 2008 7:20 am

i just want to ask that how can we use " and " and "or" in query in andorid sqlite ??
select * from coupon where coupon.PRIMARY_KEY = 1 and Coupon.POI_CATEGORY_LISTING_ID = 2
zeeshan
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Mar 03, 2008 6:10 am

Postby cadlg » Mon Mar 31, 2008 3:47 pm

You could use:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Coupon.PRIMARY_KEY + "=" + couponPrimayKey + " AND " + Coupon.POI_CATEGORY_LISTING_ID + "=" + poid
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


as your selectionSring.

Hope this helps.

cadlg
cadlg
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Wed Feb 20, 2008 12:33 am
Location: Guatemala

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 19 guests