The user {
U_id pk
}
SignIn {
S_id pk
The date
U_id fk1 - fk
}
I need to query the user
1. In 2019-1-13, and 2019-1-13 users have signIn
2. No signIn the line s_id should be NULL
How to query, can do it, now I in addition to code is used to implement logic, and SQL really don't know how to use the simultaneous to make 2 set up, maintain a null line
CodePudding user response:
Please enter a string length is at least 6CodePudding user response:
Please enter a string length is at least 6CodePudding user response:
You show some two tables of contentAnd then give out the result you want
Best to create table statements, INSERT statements are written out, convenient others to help you
CodePudding user response:
Directly to the left the right side of the join table no data should be null by defaultCodePudding user response:
Select a t1. The uid, t2. Sid the from user t1 left join (
Select the sid, uid from signIn where the date between startDate and endDate
) t2 on t1. The uid=t2. The uid.