SELECT QUESTION

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • k4

    SELECT QUESTION

    Here is my problem:

    I have two tables. Table1 contains two fields. Field1 contains names
    of job types (Accountant,Doc tor,etc.) Field2 contains the number of
    cases to select from Table2 for each job type.

    Table2 contains three fields. Field1 contains Unit
    codes(Unit1,Uni t2,etc.).Field2 contains job type.Field3 contains
    information about the action to be taken.

    I need to perform a select that chooses the number of cases shown in
    table2 for the job type that matches in both tables. i need to make
    sure that I select that number for every available unit and job
    function. The selections must be random.

    As an example: I have 16 units. Each unit contains accountants and
    doctors. Table1 has 5 in number of cases for accountants and 10 for
    doctors. Based on this, for each of the 16 units I need to randomly
    select 5 actions for accountants and 10 cases fo doctors.

    I am using Sql Server 2000.

Working...