有提要和点赞表,首先我从提要表中查询数据,然后尝试为获取提要的点赞表获取点赞。
饲料表:
`feed_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`feed_postid` INT(15) UNSIGNED NOT NULL,
`feed_type` VARCHAR(40) NOT NULL,
`feed_userid` INT(12) UNSIGNED NOT NULL,
`feed_privacy` TINYINT(1) UNSIGNED NOT NULL,
`feed_uids` TEXT NULL,
`feed_title` VARCHAR(180) NULL DEFAULT NULL,
`feed_content` TEXT NOT NULL,
`feed_dateline` DATETIME NOT NULL,
喜欢表:
like_id
like_userid
like_type
like_postid
现在我想要查询表格喜欢这样的表格
IN((1, 'status'),(2,'image'),(3, 'status'))
// IN((like_postid,like_type),(like_postid,like_type),(like_postid,like_type))
示例查询:
SELECT * FROM likes WHERE like_postid = 1 AND like_type = 'status' OR like_postid = 2 AND like_type = 'image' OR like_postid = 5 AND like_type = 'status';
现在我想用 IN 函数重写顶部查询
SELECT * FROM likes WHERE like_postid, like_type IN((1,'status'), (2,'image'), (5, 'status')); --but this is not work, there is any way to do this?