我有一名FIELD 医生的病人,附表中的撇号紧急
我试过了:
package other;
public abstract class BaseClass {
protected Integer field1;
BaseClass () {
}
public Integer getField1 () {
return field1;
}
public void setField1 (Integer field1) {
this.field1 = field1;
}
}
package my;
import other.BaseClass;
public abstract class BaseClassBuilder<T extends BaseClass, BU extends BaseClassBuilder> {
protected T obj;
protected BaseClassBuilder (T obj) {
this.obj = obj;
}
protected final BU getThis () {
return (BU) this;
}
public BU withField1 (Integer field1) {
obj.setField1(field1);
return getThis();
}
public T build () {
return this.obj;
}
}
package other;
import java.util.UUID;
public class SubClass extends BaseClass {
protected UUID field2 = null;
public SubClass () {
}
public UUID getField2 () {
return field2;
}
public void setField2 (UUID field2) {
this.field2 = field2;
}
}
package my;
import java.util.UUID;
import other.SubClass;
public class SubClassBuilder<T extends SubClass, BU extends SubClassBuilder> extends BaseClassBuilder<T, BU> {
protected SubClassBuilder (T obj) {
super(obj);
}
public BU withField2 (UUID field2) {
obj.setField2(field2);
return getThis();
}
public T build () {
return this.obj;
}
public static SubClassBuilder neu () {
return new SubClassBuilder<>(new SubClass());
}
}
package other;
public class SubSubClass extends SubClass {
protected String field3 = null;
public SubSubClass () {
}
public String getField3 () {
return field3;
}
public void setField3 (String field3) {
this.field3 = field3;
}
}
package my;
import other.SubSubClass;
public class SubSubClassBuilder<T extends SubSubClass, BU extends SubSubClassBuilder<T, BU>> extends SubClassBuilder<T, BU> {
protected SubSubClassBuilder (T obj) {
super(obj);
}
public BU withField3 (String field3) {
obj.setField3(field3);
return getThis();
}
public T build () {
return this.obj;
}
public static SubSubClassBuilder neu () {
return new SubSubClassBuilder<>(new SubSubClass());
}
}
答案 0 :(得分:1)
您可以尝试以下方式。
SELECT [doctor'spatient] FROM emergency
答案 1 :(得分:0)
设计非常糟糕,但我已经看过它了。还看到它的名字中有空格。你有两个。如果使用SQL Server,就像@mahabub建议的那样,将名称括在[方括号]中,如:
select [doctor's patient] from [emergency]
话虽这么说,您也可以使用SET QUOTED IDENTIFIER命令允许您使用双引号来分隔名称,例如,
select "doctor's patient" from "emergency"
答案 2 :(得分:0)
我很惊讶数据库让列名称过去了。名称中的特殊字符通常是禁忌。如果您不是DBA,我建议与他们交谈以重命名没有撇号的字段,并且没有空格。它会让生活更轻松。
在查询中,尝试以\'
中的方式转义撇号 SELECT * FROM emergency.'doctor\'s patient';
或
SELECT * FROM emergency."doctor\'s patient";