2017-10-11 36 views
-1
**************************physidesk (is a database)*********************** 
**doctor_personal*** 
----------------------- 
c201_user_id c201_name 
------------------------- 
1    charles 
2    jasvi 
3    vinod 
4    mahesh 

**clinic_timing** 
-------------------------------------------- 
c201_user_id c202_weekid c203_start_timing 
--------------------------------------------- 
1    mon,wed  5.30pm 
2    thurs   5.00pm 
3    thur,friday 4.30pm 

**education** 
------------------------------------- 
college_ID  c201_user_id complete_year 
------------------------------------- 
mgruniversity 1    1963 
annamalaiuniv 2    1969 

**result** 
----------------------------------------------------------------------------- 
c201_user_id c201_name c202_weekid c203_start_timing college_ID complete_year 
------------------------------------------------------------------------------ 
1    charles mon,wed  4.30pm   mgruniversity 1963 
2    jasvi  thur,friday 5.30pm   mgruniversity 1963 
3    vinod  thurs   4.30pm   annamalaiuniv 1969 
4    mahesh mon,wed  5.00pm   mgruniversity 1963 

我寫這樣的代碼:如何解決「錯誤代碼是1054'unknown列

select dp.c201_user_id 
     ,dp.c201_name 
     ,ct.c202_week_id 
     ,ct.c203_start_timing 
     ,edu.college_ID 
     ,edu.complete_year 
from physidesk.doctor_personal dp 
join physidesk.clinic_timing ct on c201_USER_ID =ct.C101_USER_ID 
join physidesk.t207_education edu on ct.C101_USER_ID=edu.C101_USER_ID; 

可以說任何的ocurring錯誤

+0

哪裏是表't207_education'? – Jens

+0

'ct.C101_USER_ID'必須是'ct.C201_USER_ID' – Jens

+0

c201_USER_ID = ct.C101_USER_ID必須是dp。 c201_USER_ID = ct.C201_USER_ID – nacho

回答

0

嘗試此查詢 -

select dp.c201_user_id 
     ,dp.c201_name 
     ,ct.c202_week_id 
     ,ct.c203_start_timing 
     ,edu.college_ID 
     ,edu.complete_year 
from physidesk.doctor_personal dp 
join physidesk.clinic_timing ct on dp.c201_USER_ID =ct.C101_USER_ID 
join physidesk.t207_education edu on ct.C101_USER_ID=edu.C101_USER_ID; 
+0

又是錯誤 –

+0

你得到了什麼錯誤。請用代碼發佈完整的錯誤。 –

0

假設你的edudation表是t207_education,下面的查詢應該可以工作。在第一次加入期間,您必須擁有dp.c201_user_id而不是c201_user_id。

select dp.c201_user_id 
    ,dp.c201_name 
    ,ct.c202_week_id 
    ,ct.c203_start_timing 
    ,edu.college_ID 
    ,edu.complete_year 
    from physidesk.doctor_personal dp 
    join physidesk.clinic_timing ct on dp.c201_user_id =ct.c201_user_id 
    join physidesk.t207_education edu on ct.c201_user_id=edu.c201_user_id; 
相關問題