|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Logic help required
I have one categories table which have catid, category and parentID.
and i have zips table which list states and city. now i am trying to load the categories based on city selection. do i need to add cityID to the categories table. 1. will that not make duplicate categories for every city. 2. if 10 cities, every city has 5 common categories. there will be a buch of duplicate categories. So is there any way you guys can provide me a suggestion. how i do this. |
|
#2
|
||||
|
||||
|
how many categories do you want each city to have?
if only one, then add a category foreign key column to the city table if more than one, you need a new many-to-many table, containing the category FK as well as the city FK |
|
#3
|
|||
|
|||
|
Gavy I see you tend to ask a fair number of SQL-related questions, so I have to ask: have you actually read a book on SQL or database design? I think something like that would help you a lot going forward, and make it much easier for you to tackle problems like this.
|
|
#4
|
|||
|
|||
|
yes but currently i am reading book on mysql beginning. i just started.
|
|
#5
|
|||
|
|||
|
I mean just an SQL book for starters. MySQL is far more complex than the SQL language itself. Something like this, which is very cheap and short, that you can read in a day or two and is an excellent resource: Teach Yourself SQL in 10 Minutes
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Logic help required |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|