'How to include cascading choice list in different fields in REDCap

I have a scenario where I have to include choice lists of district/sector/cells/village (each of them is a field). I want to build a cascade, that way a choice of list values for sector will be filtered/populated based on the previous district selected value, and so on. I am really new with sql and I have been struggling, it would be great if someone could take a look at my code, as it doesnt seem to work.

CREATE TABLE addresses (
  id MEDIUMINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  project_id VARCHAR(100),
  form_name VARCHAR(100),
  district VARCHAR(100),
  sector VARCHAR(100));

LOAD DATA LOCAL INFILE '/home/izzy/sql_addresses.txt' INTO TABLE addresses 
FIELDS TERMINATED BY '\t' 
LINES TERMINATED BY '\n'
(project_id,form_name,district, sector)
;

SELECT sector
FROM addresses
WHERE district = "[district]" 
ORDER BY sector;

Thank you for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source