SQL Server Performance

Dup. Also elsewhere on this forum site. Just need an answer ASAP

Discussion in 'Getting Started' started by mrtweaver, Nov 17, 2008.

  1. mrtweaver New Member

    Need help on indexes

    Reply Edit Favorites Contact
    I have a historical database this database is 1M+ records. Off of this historical database I have a view that uses a where clause to only show the last 3 days of production. What I am looking to try to do is find an auto increment field in the historical database that I can pull over using a Query into the view. This way I could use the following type query to get the data from the live table where there has been a change in the pagemech column:
    select t1.machine, t1.start, t1.mech from livedata t1 left join historical t2 on t1.{?} != t2.{?}+1
    The t1.{?} is the column that is copied from the Historical table into the view
    The t2.{?} is the auto incrementing column located in the historical table. This is the one I dont know where it is located or what to use. Someone in another type forum said about using an index, however is Microsoft SQL I can not seem to find out if this field is auto incrementing and how to access it so I can put it in a query to be placed in a view.
    The +1 allows offset between the two table. SO if offset of one table is on 10 the offset on the other table will be 11.
    Can someone please help.I would really like to get this query working so I can finish this section of my SCADA project at work. This is my sticking point. I can do the work in MySql but can not seem to find the comparable format in Microsoft SQL.
    I am only somewhat familar with MS SQL and the only way I know of doing things is with Management Studio and that is very limited

Share This Page