Professional Web Applications Themes

SELECT syntax problem - Microsoft SQL / MS SQL Server

How are you specifying what row is number 5, 6, 7, and so on? Ray at work "muhamad kassem" <com> wrote in message news:phx.gbl... ...

  1. #1

    Default Re: SELECT syntax problem

    How are you specifying what row is number 5, 6, 7, and so on?

    Ray at work

    "muhamad kassem" <com> wrote in message
    news:phx.gbl... 


    Ray Guest

  2. #2

    Default Re: SELECT syntax problem

    Fix your clock.

    Ray at work

    "muhamad kassem" <com> wrote in message
    news:phx.gbl... 


    Ray Guest

  3. #3

    Default Re: SELECT syntax problem

    Fix your clock.

    Ray at work

    "muhamad kassem" <com> wrote in message
    news:%phx.gbl... 
    > >
    > >[/ref]
    >
    >[/ref]


    Ray Guest

  4. #4

    Default SELECT syntax problem

    hi

    i have this query SELECT * FROM CUSTOMER

    i want to get the rows between 5-15 in example

    any one cane help me to solve this problem


    muhamad Guest

  5. #5

    Default Re: SELECT syntax problem

    If you are looking for a specific subset of rows from a sorted resultset,
    you can try:

    SELECT TOP 5 *
    FROM ( SELECT TOP 15 *
    FROM tbl
    ORDER BY sortcol ) D
    ORDER BY sortcol DESC ;

    If you need to consider ties, you can use WITH TIES clause with your TOP.
    You can also avoid TOP (which is T-SQL specific) and write your query like:

    SELECT *
    FROM tbl
    WHERE (SELECT COUNT(*)
    FROM tbl t1
    WHERE t1.col <= tbl.col ) BETWEEN 5 AND 15 ;

    If ties needs to be concerned, you'll have to adjust the WHERE clause in
    your subquery.

    --
    - Anith
    ( Please reply to newsgroups only )


    Anith Guest

  6. #6

    Default Re: SELECT syntax problem

    hi
    i have program that view the data from table
    the program view part of the data according the number of the row
    the program send to the sql the index of the rows ,the sql return the rows
    that start from this index

    this the correct time in israel
    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:phx.gbl... 
    >
    >[/ref]


    muhamad Guest

Similar Threads

  1. INSERT .. SELECT syntax
    By A in forum MySQL
    Replies: 9
    Last Post: January 22nd, 07:04 AM
  2. Need help formatting syntax for SELECT query on a Bittype data field
    By ca_nimrod in forum Coldfusion Database Access
    Replies: 2
    Last Post: January 11th, 03:23 AM
  3. Tricky SQL SELECT syntax, can it be done?
    By Mattsala in forum Macromedia ColdFusion
    Replies: 3
    Last Post: March 15th, 04:27 PM
  4. SELECT: Syntax error. Please help
    By sam in forum PHP Development
    Replies: 14
    Last Post: September 29th, 10:32 PM
  5. Help with Select Syntax
    By Chaster in forum Microsoft Access
    Replies: 1
    Last Post: July 22nd, 10:24 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139