 |
|
Code (C#)
string sql = "SELECT top 1 A.replyId, A.questionId, C.employeeCode, C.firstname AS qName, C.lastname AS qSurname, B.code, B.topic, B.description, A.description AS rDesc, B.createdId, B.createdDate ";
sql += "FROM HR_CALLCENTER.dbo.reply AS A INNER JOIN HR_CALLCENTER.dbo.question AS B ON A.questionId = B.questionId ";
sql += "INNER JOIN HR_CALLCENTER.dbo.users AS C ON B.createdId = C.employeeId ";
sql += "WHERE A.replyId = '" + id + "'";
var reply = db.replys.SqlQuery(sql);
Code
SELECT
A.replyId,
A.questionId,
C.employeeCode,
D.employeeCode,
C.firstname AS qName,
C.lastname AS qSurname,
B.code,
B.topic,
B.description AS qDesc,
A.description AS rDesc,
B.createdId,
B.createdDate
FROM
HR_CALLCENTER.dbo.reply AS A
INNER JOIN HR_CALLCENTER.dbo.question AS B ON A.questionId = B.questionId
INNER JOIN HR_CALLCENTER.dbo.users AS C ON B.createdId = C.employeeId
INNER JOIN HR_CALLCENTER.dbo.users AS D ON A.createdId = D.employeeId
WHERE A.replyId = 3
คือมันต้องใช้ข้อมูล 2 ตัวนี้ในหน้าเดียวกัน
C.employeeCode,
D.employeeCode,
ในหน้า View ผมจะอ้างถึง Model.employeeCode แต่มันไม่รู้ว่าเป็นของตัวไหน
Tag : .NET
|
ประวัติการแก้ไข 2017-02-14 16:18:04 2017-02-14 16:18:05
|
 |
 |
 |
 |
Date :
2017-02-14 15:34:17 |
By :
kenghockey |
View :
1109 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |