Urgent MySQL/PhP problem: please please advise!
Posted: Thu Sep 15, 2005 11:21 am
Hi there.
I am now desperate. I have set up a number of database tables, have over 3500 records, and now think the structure i have come up with is flawed..
I have a table called contacts, which stores companies, contact names, etc... and has for primary ID a simple index number...So every time a new contact is added, it just gets given for ID "largest current ID+1".
I also have a table of "Company Lists", which simply store the company ID, so I can generate differnt lists of companies to be listed on the website.
When I am selecting all entries from one list, I get the list of company Ids stored in the table, and then display the companies, but can't seem to display them in alphabetical ordering...
Its almost like I need to:
- Select all entries from the Company List I need
(This will return the list of IDs of these companies)
-Order these ID's by company name by sub-querying (I know it doesn't exist) the contacts table.
I am not sure if this makes any sense, but any thoughts at all are much appreciated.
Kind regards,
Duncan
I am now desperate. I have set up a number of database tables, have over 3500 records, and now think the structure i have come up with is flawed..
I have a table called contacts, which stores companies, contact names, etc... and has for primary ID a simple index number...So every time a new contact is added, it just gets given for ID "largest current ID+1".
I also have a table of "Company Lists", which simply store the company ID, so I can generate differnt lists of companies to be listed on the website.
When I am selecting all entries from one list, I get the list of company Ids stored in the table, and then display the companies, but can't seem to display them in alphabetical ordering...
Its almost like I need to:
- Select all entries from the Company List I need
(This will return the list of IDs of these companies)
-Order these ID's by company name by sub-querying (I know it doesn't exist) the contacts table.
I am not sure if this makes any sense, but any thoughts at all are much appreciated.
Kind regards,
Duncan