• prasan.dash83 (9/25/2012)


    I have are a set of create table statements having Select queries with multiple conditions. Some of the conditions include filters for the current date like:

    'Create table emp_hrs as

    (select count(emp_hours) from Emp_table where emp_name='BOB' and func_date='2012-09-19')

    And there are multiple insert statements to create one table by pulling out the data from multiple tables as created above.

    I have to use a 'select * from' statement to pull out the data from the final table.

    I hope you get a picture of this.

    Thanks,

    Prasanna

    Not really, it's still vague.

    prasan.dash83 (9/25/2012)


    ...I have an MIS system where I have to run 15 queries ...

    Can you please post one of the 15 queries? All of it if you can. The CREATE TABLE statement above won't parse - it's not valid SQL syntax.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden