Ich möchte zwei Tabellen verbinden, deren Schema wie folgt ist ... !!Wie verbinde ich zwei Tabellen mit Datum und ohne Bedingung?
Table :
team_posts
id
team_id
text
location_name
stars_count
comments_count
created_at
updated_at
team_feed_activites
id
team_id
operation
created_at
updated_at
Und die Tabellenwerte sind
team_posts
id | team_id | text | location_name | stars_count | comments_count | created_at | updated_at
1 | 23 | crow | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
2 | 24 | bird | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-03-19 06:30:00
3 | 25 | span | india | 33 | 2 | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
4 | 25 | bang | india | 3 | 2 | 2016-03-18 06:30:00 | 2016-03-12 06:30:00
5 | 27 | crow | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
6 | 23 | crow | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-01-18 06:30:00
7 | 23 | crow | india | 7 | 2 | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
8 | 23 | hen | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-03-01 06:30:00
9 | 23 | mani | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
10 | 23 | dog | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
11 | 29 | crow | india | 10 | 2 | 2016-03-18 06:30:00 | 2016-02-26 06:30:00
12 | 29 | god | india | 1 | 2 | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
13 | 29 | pen | india | 44 | 2 | 2016-03-18 06:30:00 | 2016-03-25 06:30:00
team_feed_activites
id | team_id | operation | created_at | updated_at
1 | 10 | established | 2016-03-18 06:30:00 | 2016-03-18 06:30:00
2 | 23 | established | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
3 | 23 | modified | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
4 | 24 | captian changed | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
5 | 23 | captian added | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
6 | 27 | won | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
7 | 23 | won | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
8 | 23 | paricipated | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
9 | 23 | lost | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
10 | 23 | changed pic | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
11 | 23 | addded image | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
12 | 30 | established | 2016-03-19 06:30:00 | 2016-03-19 06:30:00
Nun, was ich brauche, eine Ansicht zu erstellen ist, wo diese Tabelle in der Tabelle basierend auf updated_at Zeitpunkt zusammengeführt wird. So dass ich sehen kann, was der Team-Fortschritt Tag für Tag ist, so dass ich das als Team-Feeds nutzen kann. Kann mir jemand helfen, wie das geht .. !!! Danke im Voraus ..!!!
Was ist die Granularität Ihres Vergleichs? ein Tag ? eine Stunde ? Wenn es ein Tag ist, sollten Sie DATE (updated_at) in der WHERE-Klausel verwenden und eine GROUP BY-Klausel irgendwo – quazardous
jede Sekunde verwenden, da Aktivitäten oder Beiträge jede Sekunde erledigt werden ... –
Was Sie wollen, heißt à full Outer Join: Sie wollen alle Linien von jeft und rechtem Tisch. http://stackoverflow.com/questions/4796872/full-outer-join-in-mysql – quazardous