【发布时间】:2017-05-06 19:14:58
【问题描述】:
我有两张表,一张用于用户并存储有关用户的所有信息,但更重要的是存储为文件位置的用户个人资料图像。第二个表是图像表,其中存储图像位置和信息,例如标题和描述。
我需要将个人资料图片链接到上传照片的用户。 users 表有一个 user_id 和 profile_image,而 images 表只有一个 user_id。
如何在一个查询中选择所有图片表和个人资料图片?这甚至可能吗?
编辑 我一直在寻找连接,但似乎无法弄清楚。表格如下所示:
IMAGES USERS
id user_id
user_id username
username password
title isadmin
image (location) points
description signup_date
points email
category city
bio
profile_image
我需要选择 profile_image 以便可以使用 $row[profile_image] 调用它,但我还需要 images 表中的所有信息。希望这可以澄清事情!
【问题讨论】:
-
更新您的问题和适当的数据样本和预期结果