|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
complicated join
3 tables:
customer --------- custiomer_id - PK name assignment ----------- assignment_id - PK customer_id - FK assignment_event ----------------- assignment_event_id - PK assignment_id - FK closed event_desc ok so i need to get all the event's that are closed for a particular assignment relating to a particluar customer.. so for example. SELECT c.customer_name, c.customer.id, t.event_desc, t.closed from customer AS c, event_type AS t, assignment_event AS a where c.customer_id = a.customer_id and a.assignment_id = t.assignment_id and t.closed = 1, do you guys understand? this is prob simple as hell, i'm just really new to this sort of stuff, and have searched google for a while but i can't really get my head around it all! |
|
#2
|
||||
|
||||
|
Try this... I'm not positive it will work, but its a start...
I noticed some spelling mistakes in your post... I hope that was from you typing it out and not actual fieldnames in the table. Code:
SELECT customer.customer_name, customer.customer.id,
assignment_event.event_desc, assignment_event.closed
FROM customer, assignment, assignment_event
WHERE customer.customer_id=assignment.customer_id
AND assignment.assignment_id=assignment_event.assignme nt_id
AND customer.customer_id=1
AND assignment_event.closed=1
I made the changable-values green.. |
|
#3
|
||||
|
||||
|
It seems the forum has added peculiar spaces to one of my fieldnames in the WHERE clause... be sure to fix that when you copy&paste
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > complicated join |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|