Go with #1, but make it 4 tables.  the fourth being the relationship table 
(we'll call it Sales_Cat), that has the salespersonID, the StateID, and the 
categoryID, and for good measure, a Sales_Cat_ID.

thank you!  or you're welcome.  err hmmm


>From: "Greg Jordan" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: database structure
>Date: Thu, 07 Jun 2001 12:52:48 -0500
>
>I am setting up a database in SQL Server that will hold a sales team
>listings.  The salesperson can be in multiple categories and multiple
>states.  My question is what is the most efficient way of doing this? would
>it be....
>
>(1) setting up three tables, one for the salesperson's main record and one
>which contains the categories they are in and one that contains the states
>they are in.
>
>(2) creating a unique record for each category/state they are in, something
>like
>
><cfset categoryCount = LISTLEN(categories)>
><cfset stateCount       = LISTLEN(states)>
>
><cfif stateCount GT categoryCount>
>       <cfloop index="s" list="#states#">
>               <cfloop index="c" list="#categories#">
>                       <cfquery name="name" datasource="ds" dbtype="ODBC">
>                       INSERT INTO blah blah
>                       </cfquery>
>               </cfloop>
>       </cfloop>
><cfelse>
>       <cfloop index="c" list="#categories#">
>               <cfloop index="s" list="#states#">
>                       <cfquery name="name" datasource="ds" dbtype="ODBC">
>                       INSERT INTO blah blah
>                       </cfquery>
>               </cfloop>
>       </cfloop>
></cfif>
>
>
>
>(3) or am I missing another option?????
>
>any feedback is appreciated.
>
>G
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to