如何在SQL中编写此查询?

时间:2015-11-03 03:02:56

标签: mysql sql

所以我的这个名为#import "Picture.h" static NSString * const ClassName = @"Picture"; @implementation Picture @dynamic Caption; @dynamic Likes; @dynamic Photo; + (NSString *)parseClassName { return ClassName; } @end 的表格具有以下属性:- (IBAction)saveImage:(id)sender { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Add caption" message:nil preferredStyle:UIAlertControllerStyleAlert]; [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.placeholder = @"title"; }]; [alertController addAction:[UIAlertAction actionWithTitle:@"Save" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSArray *textFields = [alertController textFields]; NSString *nameString = ((UITextField *)textFields[0]).text; NSData *imageData = UIImagePNGRepresentation(self.chosenImage); // PFObject *object = [PFObject objectWithClassName:@"Picture"]; Picture *picture = [Picture object]; PFFile *file = [PFFile fileWithData:imageData]; [picture saveInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) { if (succeeded) { picture.Photo = file; picture.Caption = nameString; [picture saveInBackground]; [picture pinInBackground]; UIAlertController *successAlert = [UIAlertController alertControllerWithTitle:@"Photo Saved!" message:nil preferredStyle:UIAlertControllerStyleAlert]; [successAlert addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleCancel handler:nil]]; [self presentViewController:successAlert animated:YES completion:nil]; } else { NSLog(@"%@", error.localizedDescription); } }]; [alertController addAction:[UIAlertAction actionWithTitle:@"Okay!" style:UIAlertActionStyleCancel handler:nil]]; //save to parse here }]]; [self presentViewController:alertController animated:YES completion:nil]; } //image picker delegate - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info { self.chosenImage = info[UIImagePickerControllerEditedImage]; self.imageView.image = self.chosenImage; [picker dismissViewControllerAnimated:YES completion:nil]; } AlbumTitleArtistYearType只能是Ratingtype。那么我怎样才能让那些在同样发布LIVE专辑的艺术家获得 r?感谢

2 个答案:

答案 0 :(得分:0)

;WITH Alb AS 
(SELECT
    Year,Type,Artist
FROM
    Album
GROUP BY
    Year,Type,Artist)
SELECT
    AlbA.Year
    ,AlbA.Artist
FROM
    Alb AlbA
    INNER JOIN Alb AlbB ON AlbA.Year = AlbB.Year AND AlbA.Artist = AlbB.Artist
WHERE 
    AlbA.Type = 'Live'
    AND AlbB.Type = 'Studio'

答案 1 :(得分:0)

您可以自我加入

int index = listPreference.findIndexOfValue((String) value)
String entry = listpreference.getEntries()[index];

希望这有帮助。

相关问题