好的,我有两个选择语句
我想要做的是在一个选择语句中执行此操作,其中 im.alias_title =(in_image_alias_title OR a.user_id = user_id)AND a.approved = in_album_approved AND a.visible = in_album_visible;
我需要在两个结果集之间进行识别——有没有办法在查询中创建另一个列值,比如它是用户相册还是属于图像的相册。一张图片可以有多个相册。或者最好分开
/* Select all albums associated with an image */
SELECT a.alias_title, a.title, a.hits, a.created_on, a.updated_on, a.updated_by
FROM album a
INNER JOIN album_image ai ON a.id = ai.album_id
INNER JOIN image im ON ai.image_id = im.id
WHERE im.alias_title =in_image_alias_title AND a.approved = in_album_approved AND a.visible = in_album_visible;
/* Select a users albums */
SELECT a.alias_title, a.title, a.hits, a.created_on, a.updated_on, a.updated_by
FROM album a
INNER JOIN album_image ai ON a.id = ai.album_id
INNER JOIN image im ON ai.image_id = im.id
WHERE a.approved = in_album_approved AND a.visible = in_album_visible AND a.user_id = user_id;