我正在尝试从两个不同的表中返回数据,并且还从返回中过滤掉了一些数据。我有一个发布者表和一个作者表。 我收到一个错误:
MySQL编号:1064 MySQL错误:您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以在'IL'和p.state ='IL'附近使用正确的语法ORDER BY p.name,p.city,a.name,a.city,a.state'在第4行 SQL:SELECT p.name,p.city,a.name,a.city,a.state来自发布者p JOIN作者a ON(p.state = a.state)WHERE a.city ='芝加哥AND a.state = 'IL'AND p.state ='IL'按p.name,p.city,a.name,a.city,a.state的顺序 MySQL受影响的行:-1
SQL
SELECT p.name, p.city, a.name, a.city, a.state
FROM publisher p JOIN author a
ON (p.state= a.state)
WHERE a.city = 'Chicago' AND a.state = 'IL' AND p.state = 'IL'
ORDER BY p.name, p.city, a.name, a.city, a.state;
答案 0 :(得分:0)
加入状态,不必执行a.state ='IL'和p.state ='IL'。 尝试执行以下操作:
public static void main(String[] args) {
String s = "dfdf*Hwwqqw*efgftfg*ldsdsd*lwewwe*o eerrr*mwqqwq*ujk*mjfrem*mert*yfg";
String a[] = s.split("\\*");
StringBuilder b = new StringBuilder("");
for ( String newS : a )
{
b = b.append(newS.charAt(0));
}
b.replace(0,1, "");
System.out.println(b);
}