I have a mysql database that includes two tables called individuals and households. The fields for the individuals table include:
-ind_id
-first_name
-middle_name
-last_name
-household_id
The fields for the households table include:
-household_id
-head_first_name
-head_middle_name
-head_last_name
-address
-city
-province_state
-country
-postal_code
-phone
There is foriegn key relationship between the household_id fields in the two tables. The intent of the two tables is to group individuals into various households and to be able to produce a report listing selecting individuals from the database and group them by household. That isn't a problem. Using SQL and PHP, I have no problem producing a list that looks like this:
-Household Head Address Phone Occupants
-Jones, Robert John 1234 Deadend St., Anytown, USA 98004 (555) 420-5186 Jones, Ann Leslie
-Jones, Robert John 1234 Deadend St., Anytown, USA 98004 (555) 420-5186 Jones, Percy James
-Jones, Robert John 1234 Deadend St., Anytown, USA 98004 (555) 420-5186 Jones, Robert John
-Smith, John George 3567 Hollywood Blvd., Mytown, USA 97467 (308) 562-8913 Smith, Amanda Jane
-Smith, John George 3567 Hollywood Blvd., Mytown, USA 97467 (308) 562-8913 Smith, John George
-Smith, John George 3567 Hollywood Blvd., Mytown, USA 97467 (308) 562-8913 Smith, June Anne
-Smith, John George 3567 Hollywood Blvd., Mytown, USA 97467 (308) 562-8913 Smith, Winnifred
I want to produce a list that hides the repeated values, so that the same output would display like this:
-Household Head Address Phone Occupants
-Jones, Robert John 1234 Deadend St., Anytown, USA 98004 (555) 420-5186 Jones, Ann Leslie
- Jones, Percy James
- Jones, Robert John
-Smith, John George 3567 Hollywood Blvd., Mytown, USA 97467 (308) 562-8913 Smith, Amanda Jane
- Smith, John George
- Smith, June Anne
- Smith, Winnifred
I still need all of the rows to be in the record set, I just don't want them to display on PHP page. All I want to do is prevent the duplicate values from displaying in the output. Any suggestions?