I've created a reservation system with PHP scripts hitting a MYSQL database where people reserve to travel on a bus trip. It has been up and running for 2 months now and I'm very happy with it .
I (stupidly) used only one table to collect all the user info. It has columns for their first name, last name, phone number, email address date of travel and so on. The table is filling up and I already have about 9000 rows. But I know for sure that the majority of the customers are returning ones which probably puts the number of unique customers at around 2500. So I created a new table called customers (with an id self-incrementing column) which I'll populate with unique customer info only, and start using an id number for each customer.
My problem now is how to select the people that have the same phone number AND the same first name ('cause I allow separate reservations for husband and wives etc) from the existing table, and put all them into my new table ???
I've tried playing around with SELECT DISTINCT but need help!!
I (stupidly) used only one table to collect all the user info. It has columns for their first name, last name, phone number, email address date of travel and so on. The table is filling up and I already have about 9000 rows. But I know for sure that the majority of the customers are returning ones which probably puts the number of unique customers at around 2500. So I created a new table called customers (with an id self-incrementing column) which I'll populate with unique customer info only, and start using an id number for each customer.
My problem now is how to select the people that have the same phone number AND the same first name ('cause I allow separate reservations for husband and wives etc) from the existing table, and put all them into my new table ???
I've tried playing around with SELECT DISTINCT but need help!!