如何檢索我想用連接編寫嵌套查詢的數據? 我想從t1
顯示first_name
,designation
,並且顯示project_name
,col2
來自t2
,其中end_date= (select max(end_date) from project where res_id=?)
;加入嵌套查詢
能否請你幫我寫SQL查詢
select R.first_name, R.Designation, R.DOB, R.DOJ, R.Department,
R.city, p.project_name, p.start_date, p.end_date,
p.end_date+1 as next_avail_date
from resources R full JOIN project p on (r.res_id=p.res_id)
where r.u_id='&u_id';
我想選擇基於以下查詢
select project_name from project where end_date= (select max(end_date) from project where res_id=1);
如何添加它在上面的查詢項目名稱?
請顯示您的代碼。 –
select R.first_name,R.Designation,R.DOB,R.DOJ,R.Department, R.city,p.project_name,p.start_date,p.end_date, p.end_date + 1 as next_avail_date from resources R (r.res_id = p.res_id)其中r.u_id ='&u_id';我想從項目中選擇project_name,其中end_date =(從res_id = 1的項目中選擇max(end_date)); –