OKAN ARI wrote:
I have 3 tables
Table 1: user(id, name, surname)
Table 2: crime(id, detail)
Table 3: user_crime(id, user_id, crime_id)

Table 1
1, OKAN, ARI

Table 2
1, "detail 1"
2, "Detail 2"

Table 3
1, 1, 1
1, 1, 2

So user 1 takes 2 crime from crime table...

I want to receive info with 1 query: I need name surname and his crime_ids of user_id 1
So result might be:
user_id, name, suername, crime_ids
1, OKAN, ARI, {1-2}
SELECT u.name, u.surname, uc.crime_id, c.detail
FROM user AS u
INNER JOIN user_crime AS uc ON u.id=uc.user_id
INNER JOIN crime AS c ON uc.crime_id=c.id
WHERE u.id=1

PB


Is it possible?

gibi....

Mumkun mu?


-----------------------------------------------------
Iletisim teknolojilerinin gucunu ispatlayan iletisim teknolojileri dergisi: Tele.com.tr
http://www.tele.com.tr



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to