您好我已经尝试使用以下查询从表中获取数据,但它无法正常工作..
@interface Bean : NSObject
// Add your props
// ...
// .....
@end
@implementation Bean
- (instancetype)init {
self = [super init];
if (self) {
[self setDefaultPropValues];
// TODO: All other initializations
}
return self;
}
- (void)setDefaultPropValues {
[self setDefaultPropValuesForClass:self.class];
}
- (void)setDefaultPropValuesForClass:(Class)refClass {
if (![refClass isSubclassOfClass:[Bean class]]) {
return;
}
// First set default property values in super classes
Class baseClass = class_getSuperclass(refClass);
[self setDefaultPropValuesForClass:baseClass];
//
unsigned int numberOfProperties = 0;
objc_property_t *propertyArray = class_copyPropertyList(refClass, &numberOfProperties);
for (NSUInteger i = 0; i < numberOfProperties; i++)
{
objc_property_t property = propertyArray[i];
NSString *name = [NSString stringWithUTF8String:property_getName(property)];
const char * propAttr = property_getAttributes(property);
NSString *propString = [NSString stringWithUTF8String:propAttr];
NSArray *allAttrs = [propString componentsSeparatedByString:@","];
// Check if property is readonly
if (NSNotFound == [allAttrs indexOfObject:@"R"]) {
// Find Property type token
NSArray * attrArray = [propString componentsSeparatedByString:@"\""];
if (attrArray.count > 1) {
Class propType = NSClassFromString([attrArray objectAtIndex:1]);
if ([propType isSubclassOfClass:[NSString class]]) {
[self setValue:@"" forKey:name];
}
}
}
}
free(propertyArray);
}
@end
显示表 SELECT
ProductMaster.ProductName + '(' + CONVERT(nvarchar(10), 0) + ')' AS orderedproducts,
BranchName + '(' + CONVERT(nvarchar(10), SUM(StockInward.Qty)) + ')' AS currentstock,
Setup.Id AS BranchId
FROM ProductMaster
INNER JOIN StockOutward
ON ProductMaster.Productid = StockOutward.productid
INNER JOIN stockinward
ON ProductMaster.Productid = stockinward.productid
AND stockinward.StockLocation <> StockOutward.Location
INNER JOIN Setup
ON stockinward.stocklocation = Setup.id
WHERE StockOutward.ProductId = '7'
GROUP BY ProductMaster.ProductName,
StockOutward.Qty,
BranchName,
Setup.Id
中的所有记录。
答案 0 :(得分:0)
尝试在您的内部联接中移动您的&lt;&gt;在where子句中。 在您的示例中,您是否尝试了更简单的查询(选择1个简单元素并逐个添加内部连接。