Reputation: 3549
I am trying to learn relationship between tables, I have two tables APPLICATION,SERVER_STATUS.The following is the table structure for the application.
mysql> desc application;
+-------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+----------------+
| applicationId | int(11) | NO | PRI | NULL | auto_increment |
| applicationName | varchar(100) | YES | | NULL | |
| startDate | date | YES | | NULL | |
| endDate | date | YES | | NULL | |
| prjectedStartTime | date | YES | | NULL | |
| prjectedEndTime | date | YES | | NULL | |
| currentAction | varchar(200) | YES | | NULL | |
| danoneValidation | varchar(200) | YES | | NULL | |
| comments | varchar(200) | YES | | NULL | |
+-------------------+--------------+------+-----+---------+----------------+
Now each application has 3 server statuses like in-progress,ready and completed.For maintaining the server I have taken a table SERVER_STATUS,there I am maintaining server statuses like in-progress,ready and completed. How do I make relationship between these 2 tables? The following is my tables structure.
Upvotes: 0
Views: 56
Reputation: 3106
check This.
select * from application a
inner join serverstatus s on s.status=a.status and s.applicationId=a.applicationId
You can make relationship among this table using common column. which is status and applicationId.
Upvotes: 1