[RESOLVED] [2005] Filter Combobox Display
Hi! I have table containing name of the student and its enrolled subjects.
John Doe Eng1
John Doe Mat1
John Doe Sci1
John Doe P.E.1
I can already display names in the combobox, problem is if the name john doe appears in the table 4x then it will also appear 4x in the combobox. How do i filter it so that combobox will only display the name once. I am using IDNumber as primary in my table (sql).
Re: [2005] Filter Combobox Display
Silly question, what happens if their are 2 John Does'?
Re: [2005] Filter Combobox Display
Can you pls post your sql query here? It seems that you have not written DISTINCT in your sql query.
Re: [2005] Filter Combobox Display
select distinct <John Doe Column> from ....
Re: [2005] Filter Combobox Display
Quote:
Originally Posted by Lerroy_Jenkins
Silly question, what happens if their are 2 John Does'?
It may seem silly to you but not for me. What I am doing it here is a registration program where I register the subjects enrolled by a certain students. I have a masterfile containing all the students info. I retrieve student's name and select a student's year level from a combobox and base on the yearlevel all the subjects corresponding for that year level will be displayed in a datagridview from there I click save button to store all records to a table (sql) and since a certain student has 1 or more subjects I get multiple John Does' in my table.
I hope this explain why it's not a silly question.
Re: [2005] Filter Combobox Display
Quote:
Originally Posted by Deepak Sakpal
Can you pls post your sql query here? It seems that you have not written DISTINCT in your sql query.
Quote:
Originally Posted by Jonga
select distinct <John Doe Column> from ....
Thanks to you both! It works!