Assuming your first table is Ring
and the second one is RingTone
You have to JOIN
to the Ring
table twice:
SELECT
rt.ID,
DayRingTone = r1.RingName,
NightRingTone = r2.RingName
FROM RingTone rt
INNER JOIN Ring r1
ON rt.DayRingTone = r1.RingID
INNER JOIN Ring r2
ON rt.NightRingTone = r2.RingID
Try this way
SELECT
rt.ID,
DayRingTone = b.RingName,
NightRingTone = c.RingName
FROM tableringtone a
INNER JOIN tablering b
ON a.DayRingTone = b.RingID
INNER JOIN tablering c
ON a.NightRingTone = c.RingID
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.