简体   繁体   中英

SQL - two tables retrieving data

i try to retrieve data but i think i'm not good at sql query.

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.
What i want to do retrieve data like that

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.

select * 
from   T2 join 
       eventCategory AS e on T2.eventCategoryID = e.id

I'm assuming your second table has an 'eventCategoryID' field. If it doesn't, then I would need to know how you would relate it to the other table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM