我的数据库中有两个表。其中一个是名为players
的表,另一个是bans
:
players table: ID, Score
bans table: user_id, reason
我需要做的是:选择原因=作弊和得分<250 。
当我尝试FULL JOIN时我尝试做一些JOINS,我发现MySQL中不存在该东西,所以任何帮助都会很好,谢谢!!
我也这样尝试过,但我总是得到零行
SELECT bans.user_id, players.ID
FROM bans
INNER JOIN players ON bans.user_id=players.ID;
禁令表
user_id reason
133032 swearing
133040 name not allowed
玩家桌
id score
15 13378
21 215216
133032 15
133040 157
答案 0 :(得分:0)
您的查询是一个好的开始。对于您的样本数据,它将为您提供结果。为了满足您的要求,您只需要几个其他过滤器:
public static void main(String[] args) {
int maxContacts = 20;
Contact[] contacts = new Contact[maxContacts]; // initialize array of size 20
Scanner scanner = new Scanner(System.in);
String firstName;
String lastName;
String phone;
String email;
//collect 20 contacts into array
for (int i = 0; i < maxContacts; i++) {
System.out.println("insert first name : ");
firstName = scanner.nextLine();
System.out.println("insert last Name : ");
lastName = scanner.nextLine();
System.out.println("insert phone : ");
phone = scanner.nextLine();
System.out.println("insert email : ");
email = scanner.nextLine();
contacts[i] = new Contact(firstName, lastName, phone, email);
}
// Just print contacts array is full
if (contacts.length == maxContacts) {
System.out.println("maxiumum number of adding contact has reached");
}
//Now just sort the array based on name
Arrays.sort(contacts);
//Finally print contacts in order
for (Contact contact : contacts) {
System.out.println(contact.toString());
}
}