As you can see i have a table contain several IDs including Survey_survey ID and Store ID, i want to get all the Store IDs and their Survey_surveyIDs without duplicates.
Here is what i have tried
$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']."");