Loading ...
Sorry, an error occurred while loading the content.

Retrieve only 1 record

Expand Messages
  • joko8338
    how to retrieve only 1 record without using TOP command. i use SQL SERVER CE which doesn t have TOP command. Thanks
    Message 1 of 4 , Oct 28, 2003
    • 0 Attachment
      how to retrieve only 1 record without using TOP command. i use SQL
      SERVER CE which doesn't have TOP command.






      Thanks
    • Richard Rogers
      Perhaps you can use the GROUP or DISTINCT clause(s) ... From: joko8338 [mailto:joko8338@yahoo.com] Sent: Tuesday, October 28, 2003 2:27 PM To:
      Message 2 of 4 , Nov 5, 2003
      • 0 Attachment
        Message
        Perhaps you can use the GROUP or DISTINCT clause(s)
        -----Original Message-----
        From: joko8338 [mailto:joko8338@...]
        Sent: Tuesday, October 28, 2003 2:27 PM
        To: SQLQueriesNoCode@yahoogroups.com
        Subject: [SQLQueriesNoCode] Retrieve only 1 record

        how to retrieve only 1 record without using TOP command. i use SQL
        SERVER CE which doesn't have TOP command.






        Thanks





        To unsubscribe from this group, send an email to:
        SQLQueriesNoCode-unsubscribe@yahoogroups.com



        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. The contents of this e-mail are confidential. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Please virus check all attachments to prevent widespread contamination and corruption of files and operating systems!
      • (DMR) Mark Gorelik
        SET ROWCOUNT 1 SELECT * FROM MYTABLE --------WILL RETURN FIRST ROW SET ROWCOUNT 0 SELECT * FROM MYTABLE -------WILL RETURN EVERYTHING Mark Gorelik Fujitsu
        Message 3 of 4 , Nov 5, 2003
        • 0 Attachment
          SET ROWCOUNT 1
          SELECT * FROM MYTABLE --------WILL RETURN FIRST ROW

          SET ROWCOUNT 0
          SELECT * FROM MYTABLE -------WILL RETURN EVERYTHING

          Mark Gorelik
          Fujitsu Consulting
          416 969-7141



          -----Original Message-----
          From: joko8338 [mailto:joko8338@...]
          Sent: Tuesday, October 28, 2003 3:27 PM
          To: SQLQueriesNoCode@yahoogroups.com
          Subject: [SQLQueriesNoCode] Retrieve only 1 record


          how to retrieve only 1 record without using TOP command. i use SQL
          SERVER CE which doesn't have TOP command.






          Thanks





          To unsubscribe from this group, send an email to:
          SQLQueriesNoCode-unsubscribe@yahoogroups.com



          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



          *** This communication is strictly private and contains confidential
          information intended solely for the addressee(s). Access to this
          communication by parties other than the intended recipient(s) is
          unauthorized. If you have received this communication in error and are not the intended recipient, any disclosure, copying, distribution or action
          taken is strictly prohibited and may be unlawful. ***
        • Razvan Socol
          I am surprised by your affirmation that SQL Server CE doesn t have the TOP command . If that is true, you can try the following alternatives to the TOP
          Message 4 of 4 , Nov 8, 2003
          • 0 Attachment
            I am surprised by your affirmation that "SQL Server CE doesn't have the TOP command".
            If that is true, you can try the following alternatives to the TOP option:
             
            a) SET ROWCOUNT
            for example:
            SET ROWCOUNT 1
            SELECT * FROM YourTable ORDER BY SomeColumn
            SET ROWCOUNT 0
             
            b) Subqueries
            for example:
            SELECT * FROM YourTable WHERE SomeColumn
            =(SELECT MIN(SomeColumn) FROM YourTable)
             
            Razvan
             
          Your message has been successfully submitted and would be delivered to recipients shortly.