正如您所看到的,我的表格包含多个ID,包括Survey_survey ID和商店ID,我希望获得所有商店ID 及其 Survey_surveyID ,而不会重复。
这是我试过的
$getSurvey = mysqli_query($dbConnection , "SELECT DISTINCT Survey_surveyId FROM maintable");
while ($row = mysqli_fetch_array($getSurvey)) {
$getStoreIDS = mysqli_query($dbConnection , "SELECT DISTINCT Stores_storeID FROM maintable WHERE Survey_surveyId=".$row['Survey_surveyId']."");