SELECT *
FROM StudentDetails
JOIN StudentMaster
ON Right(concat('000000', StudentDetails.ID),6) = StudentMaster.ID
数据如下: 学生详细信息表
ID Fathers Name
123 Martin
124 Mike
StudentMaster表
ID Name Class
000123 John 10
000124 Mark 11
查询的o / p应为:
ID Fathers Name ID Name Class
123 Martin 000123 John 10
124 Mark 000124 Mike 11