我執行的查詢結果中沒有空值。下面是我query
使用MySQL排除數據庫結果表中的空值
SELECT
sur.id AS 'Survey ID',
DATE (sur.capture_date) AS 'Date',
sur.sub_division AS 'Sub-Div',
sd.name AS 'Sub-Div Name',
sd.`circle_name` AS 'Circle Name',
sur.ref_no AS 'Reference Number',
sur.customer_id AS 'Customer ID',
sur.consumer_name AS 'Consumer Name & Address',
sur.sync_date AS 'Sync Date',
sur.capture_date AS 'Capture Date',
sur.latitude AS Latitude,
sur.longitude AS Longitude,
sur.near_by_place AS Comments,
sur.tarrif AS Tariff,
sur.s_load AS 'Sanctioned Load',
sur.meter_type AS 'Meter Type (IT)',
sur.meter_type_field AS 'Meter Type (Field)',
sur.meter_type_desired AS 'Meter Type (As Desired By SDO)',
sur.pole_type AS 'Pole Type',
sur.meter_location AS 'Meter Location',
sur.est_cable_len AS 'Estimated Cable Length',
sur.meter_status AS 'Meter Status',
sur.running_load_entry_a AS 'Running Load Entry (A)',
sur.running_load_entry_b AS 'Running Load Entry (B)',
sur.running_load_entry_c AS 'Running Load Entry (C)',
MAX(CASE WHEN sn.operator_name LIKE '%Zong%' THEN sn.signal_strength END) AS Zong,
MAX(CASE WHEN sn.operator_name LIKE '%Mobilink%' THEN sn.signal_strength END) AS Mobilink
FROM survey sur
INNER JOIN
survey_networks sn ON sur.id = sn.survey_id
INNER JOIN
survey_hesco_subdivision sd ON sur.sub_division = sd.sub_div_code
WHERE
sn.`signal_strength` = 'No Signal' AND
sn.`operator_name` IN ('Zong','Mobilink') AND
sn.`signal_strength` IS NOT NULL
GROUP BY
sur.id,
sur.sub_division,
sur.ref_no,
sur.customer_id,
sur.consumer_name,
sur.consumer_address ,
sur.sync_date,
sur.capture_date,
sur.source,
sur.latitude,
sur.longitude,
sur.near_by_place,
sur.tarrif,
sur.s_load,
sur.meter_type,
sur.meter_type_field,
sur.meter_type_desired,
sur.pole_type,
sur.meter_location,
sur.est_cable_len,
sur.meter_status,
sur.running_load_entry_a,
sur.running_load_entry_b,
sur.running_load_entry_c
ORDER BY
sd.`name` ASC;
正如我已經添加IS NOT NULL
查詢顯示,但如下圖所示的圖像
任何幫助將高度讚賞還是我得到空值
見https://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very -simple-sql-query – Strawberry