[英]SQL - two tables retrieving data
i try to retrieve data but i think i'm not good at sql query. 我尝试检索数据,但我认为我不擅长sql查询。
i have a table eventCategory 我有桌活动
and one more table 还有一张桌子
This two table is created in order to use in one table this is the initplayer table. 创建这两个表是为了在一个表中使用initplayer表。
What i want to do retrieve data like that 我想做的是检索这样的数据
30191592 Izlesene.com 7 2012-02-22 izlesene_cihan_v4 30191592 Izlesene.com 7 2012-02-22 izlesene_cihan_v4
How can i do that ? 我怎样才能做到这一点 ? pls show me the way ?
请给我指路? How can i use these two tables?
我如何使用这两个表?
TRY 尝试
SELECT la.id,st.profileName, la.totalEvents,la.Date,ft.eventCategory
FROM lastTable la
INNER JOIN secondTable st ON st.id=la.id
INNER JOIN firstTable ft ON ft.id = la.eventCategoryID
You didn't say the name of the second table so I will just call it T2. 您没有说第二张桌子的名字,所以我将其命名为T2。
select *
from T2 join
eventCategory AS e on T2.eventCategoryID = e.id
I'm assuming your second table has an 'eventCategoryID' field. 我假设您的第二张表有一个'eventCategoryID'字段。 If it doesn't, then I would need to know how you would relate it to the other table.
如果没有,那么我将需要知道如何将其与另一个表关联。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.