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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -