ฉันมีตารางและฉันต้องเลือกแถวทั้งหมดที่มีค่าว่างสำหรับfk_fc_id
ฟิลด์ (เพื่อนำไปลบ)
Column | Type | Modifiers
---------------+-----------------------------+------------------------------------------------------------
di_timestamp | timestamp without time zone |
di_item_value | character varying(10) |
fk_fc_id | integer |
di_id | integer | not null default nextval('data_item_di_id_seq1'::regclass)
อย่างไรก็ตามสิ่งนี้ไม่ทำงาน
# select fk_fc_id,di_timestamp,di_item_value from data_item where fk_fc_id="";
ERROR: zero-length delimited identifier at or near """"
LINE 1: ...di_timestamp,di_item_value from data_item where fk_fc_id="";
^
การพยายามNull
ไม่ทำงานเช่นกัน
หากใครมีข้อเสนอแนะเกี่ยวกับวิธีการจัดเรียงนี้ฉันจะขอบคุณมาก
1
เลือก fk_fc_id, di_timestamp, di_item_value จาก data_item ที่ fk_fc_id เป็นโมฆะ
—
foibs
อัญประกาศคู่ไม่ได้ใช้สำหรับสตริงใน PostgreSQL ใช้เครื่องหมายคำพูดเดี่ยวสำหรับสตริง แต่คุณไม่ควรเปรียบเทียบสตริงที่มีความยาวเป็นศูนย์กับจำนวนเต็ม! และการเปรียบเทียบค่ากับการ
—
Colin 't Hart
null
ใช้=
โอเปอเรเตอร์จะส่งคืนnull
และทำให้แถวนั้นถูกแยกออกเสมอ