title: Retrieve a database data based on another column
body: <p><a href="https://i.stack.imgur.com/QZp1z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QZp1z.jpg" alt="enter image description here"></a></p>
  
  <p>I have columns <code>Number</code> and <code>College</code> in my database. What I'm trying to do is get the <code>Number</code> column based on my <code>College</code> column. For example, I have my combobox and if I select "SCITECH" then it will get all the <code>Number</code>s of "SCITECH" people.</p>
  
  <p>I tried to using this code but I can't retrieve the numbers.</p>
  
  <pre><code> If Form1.TextBox1UN.Text = "admin" Then
                   Query = "Select * from database.students"
  
              Else
                  Query = "Select * from database.students where College ='" &amp; Form1.ComboBox1.SelectedItem &amp; "'"
                  COMMAND = New MySqlCommand(Query, mydbcon)
  
                  reader = COMMAND.ExecuteReader
                  While reader.Read
  
                      ComboBox3.Items.Add("Number")
  </code></pre>