Mysql查询顺序由longtext值作为int

时间:2018-01-06 14:31:34

标签: mysql

我在下面尝试查询它给我错误。什么是错误

#define MyPrivateTableViewDataType @"MyPrivateTableViewDataType"


[self.tableView setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO];
[self.tableView registerForDraggedTypes:[NSArray arrayWithObjects:MyPrivateTableViewDataType,NSFilesPromisePboardType,NSFilenamesPboardType,nil]];



//handling drag and drop

-(BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard{

NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
[pboard declareTypes:[NSArray arrayWithObjects:MyPrivateTableViewDataType,NSFilenamesPboardType,nil] owner:self];


NSPoint dragPosition;
NSRect imageLocation;

NSEvent *event =[NSApp currentEvent];
dragPosition = [tv convertPoint:[event locationInWindow] fromView:nil];

dragPosition.x -=16;
dragPosition.y -=16;

imageLocation.origin=dragPosition;
imageLocation.size=NSMakeSize(32, 32);
[tv dragPromisedFilesOfTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil] fromRect:imageLocation source:self slideBack:YES event:event];

return YES;
}


-(NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination{
NSString *str=[dropDestination path];
NSLog(@"%@", str);
NSMutableArray *rootDraggedItems=nil;
return  rootDraggedItems;

}

-(NSDragOperation)tableView:(NSTableView *)tv validateDrop:(id<NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation{
if ([info draggingSource] !=tv) {
    return  NSDragOperationCopy;
}
return NSDragOperationNone;
}

-(BOOL)tableView:(NSTableView *)tv acceptDrop:(id<NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation{

NSPasteboard *pboard = [info draggingPasteboard];

NSArray *files=[pboard propertyListForType:NSFilenamesPboardType];
NSInteger i;
for (i=0; i<[files count]; i++) {
    NSString *filePath = [files objectAtIndex:i];
    NSString *path =[filePath stringByStandardizingPath];
    NSLog(@"%@", path);
}


NSLog(@"%ld", (long)row);


return YES;
}
  

查询:SELECT listingsdbelements_field_value FROM   default_en_listingsdbelements ORDER BY   CAST(listingsdbelements_field_value AS INT)AS ...

     

错误代码:1064您的SQL语法出错;检查   手册,对应右边的MySQL服务器版本   要在'INT)附近使用的语法ASC LIMIT 0,1000'在第3行

1 个答案:

答案 0 :(得分:1)

根据您的需要使用已签名或未签名。

SELECT listingsdbelements_field_value
FROM default_en_listingsdbelements
ORDER BY CAST(listingsdbelements_field_value AS UNSIGNED) ASC 

来自MySQL - SIGNED将值转换为SIGNED类型,这是一个带符号的64位整数 UNSIGNED将值转换为UNSIGNED类型,这是一个无符号的64位整数