开发者

How to match two fields in an SQL query?

Please correct the query.

It is working but it gives the wrong result, I have database tables that look like this.

[3rdi_EventsRolePrice] :-EventID, RoleID, RolePrice
[3rdi_EventsRolePrice]:- FirstName, LaastName And EventID

I want to get FirstName, LastName, RoleID by joining these two, and I am passing an event value开发者_开发百科 as a parameter which is 13 in my case just for getting result.

SELECT ep.FirstName, ep.LastName, erp.RoleID 
from [3rdi_EventParticipants] ep,[3rdi_EventsRolePrice] erp
WHERE  ep.EventID==erp.EventID and erp.EventID='13'

I want to match where these two things "ep.EventID==erp.EventID" are equal, and their value is also 13. My query is also working syntaxically correct but I get a thoroughly wrong result.


SELECT 
 ep.FirstName,
 ep.LastName,
 erp.RoleID

 FROM [3rdi_EventParticipants] ep
 INNER JOIN [3rdi_EventsRolePrice] erp
 ON  ep.EventID = erp.EventID 
 WHERE erp.EventID='13'

I think it will work..


ep.EventID==erp.EventID to ep.EventID=erp.EventID

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜