SQL ordering in XCode -
i want order data variables , select first record. doesn't work. here code:
nsstring *s = [db stringforquery:@"select cardinfo.?, cardinfo.?, cardinfo.? cardinfo cardinfo.currentbalance > ? order cardinfo.? desc, cardinfo.? desc, cardinfo.? asc ", first, second, third, [nsnumber numberwithdouble:money], first, second, third]; if change ordering constants, works.
nsstring *s = [db stringforquery:@"select a, b, c cardinfo cardinfo.currentbalance > ? order desc, b desc, c asc ",[nsnumber numberwithdouble:money]]; does know how correct it? lot.
yep. order cardinfo.? attempts parameterize metadata, column name. prepared statements allow parameterize data only.
you can say
where tablename.colname = ? you cannot say
where ?.colname = 'foo' hth.
Comments
Post a Comment