Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2006
    Posts
    57

    Unanswered: Getting one row from a clustered date table

    Is it possible to efficiently pull one row from a table that is clustered by the date. What i want to do is pull one row wheather it be the first row the 1028th row or row 3000. Is this possible to do?

    What I have is:
    Code:
    SELECT * FROM CUST WHERE '?' = 3000
    My cust column is already in order because it is clustered.
    Last edited by Luke101; 11-30-06 at 22:25.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    that query will be efficient only if the '?' column has an index

    (that's not the real name of the column, is it?)

    also, first, you say clustered by date, and then you say clustered by cust -- that's not possible, because a table can have only one clustered index
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Sep 2006
    Posts
    57
    OH sorry CUST is the table and i have a date column that clustered. I do have an index "CUST_ID" but this column is not ordered like the date column. When I view the table the CUST_ID values are scattered i am not sure why.

    Also, one more question is there any kind of limit to how many tables i can have in one database?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    of course the CUST_ID values are scattered -- the rows are in sequence by date
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •