0
我想在一個SQL語句中獲取考試日期,測試和測試名稱的值。我能夠分兩個階段完成,但不能完成一個階段。當我嘗試合併它時,我會在標題中發現錯誤。#1066 - 非唯一表/別名:'考試'
這裏是SQL語句產生錯誤:
select date, value, tname from examination, testresults, testname
LEFT JOIN examtype ON examtype.etype_id = examination.etype_id
LEFT JOIN examination ON examination.examination_id = testresults.examination_id
LEFT JOIN testname ON testname.tname_id = testresults.tname_id
where examination.patientnhs_no= '1001001002'
and date > '2008/09/05'
and examtype.name like 'blood%'
and testname.name like'tsh%'
order by date asc
limit 1
內部連接與'考試'並再次'連接'與'考試'?不知道如何在多次加入同一個表格時需要提供唯一的別名。 'date,value和tname'來自哪個表? – 2014-11-21 19:50:25