SQL, SQL, SQL - problem

Results 1 to 2 of 2

Thread: SQL, SQL, SQL - problem

  1. #1
    89 Guest

    Default SQL, SQL, SQL - problem

    Hello,<BR>The SQL-code for showing the top 5 posts from a table is.<BR>SQL - SELECT top 5 FROM table<BR><BR>But, i want to show the top1 latest (the latest) post in one place. And the the top 2-10 in another place. How to do?

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL, SQL, SQL - problem

    If I understand this right you want to be able to fetch the first post and 2-10 post.<BR><BR>A simple way of doing this could be to ad a &#039id&#039-field in the table. And then just do like this:<BR><BR>&#039to get the first post<BR>SQL = "SELECT * FROM TheTable WHERE id = 1"<BR><BR>&#039to get posts 2-10<BR>SQL = SELECT * FROM TheTable WHERE id &#062; 1 AND id &#060; 11"<BR><BR>That should work....

Posting Permissions

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