How to get only 15 records !!! 
Author Message
 How to get only 15 records !!!

Hi everybody,

I want to get only 15 records of the table.
the query must have return only 15 records.

It's possible?

Srgio Penelc

Programador e Tcnico em Informtica
Web and Corp. Developer
PMS/SUCOM





* principal (first)

ICQ no. 56843734

SALVADOR/BAHIA



Wed, 15 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!
Oh GOD!!!!! WHAT A CROSS POSTING NIGHTMARE!!!!!!

Do you mean 15 records as in the FIRST 15 records:
SELECT TOP 15 * FROM MyTable

Or do you mean where there are only 15 records

SELECT * FROM MyTable Where Count(*)=15


Quote:
> Hi everybody,

> I want to get only 15 records of the table.
> the query must have return only 15 records.

> It's possible?

> Srgio Penelc

> Programador e Tcnico em Informtica
> Web and Corp. Developer
> PMS/SUCOM





> * principal (first)

> ICQ no. 56843734

> SALVADOR/BAHIA



Wed, 15 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!
Srgio,

Please do not post to every imaginable newsgroup ... one or two is quite
sufficient ...

use pubs

set rowcount 15
select * from authors
set rowcount 0

---------------------------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc) which can be
cut and pasted into Query Analyzer is appreciated.


Quote:
> Hi everybody,

> I want to get only 15 records of the table.
> the query must have return only 15 records.

> It's possible?

> Srgio Penelc

> Programador e Tcnico em Informtica
> Web and Corp. Developer
> PMS/SUCOM





> * principal (first)

> ICQ no. 56843734

> SALVADOR/BAHIA



Wed, 15 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!
Not 100% sure about the DBMS you are using but select * from table where
rowcount > 15; Rowcount in oracle is a reserved oracle psuedo column .


Quote:
> Hi everybody,

> I want to get only 15 records of the table.
> the query must have return only 15 records.

> It's possible?

> Srgio Penelc

> Programador e Tcnico em Informtica
> Web and Corp. Developer
> PMS/SUCOM





> * principal (first)

> ICQ no. 56843734

> SALVADOR/BAHIA



Wed, 15 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!
Very Simple:
SELECT * TOP 15 FROM TABLE {WHERE...}


Quote:
> Not 100% sure about the DBMS you are using but select * from table where
> rowcount > 15; Rowcount in oracle is a reserved oracle psuedo column .



> > Hi everybody,

> > I want to get only 15 records of the table.
> > the query must have return only 15 records.

> > It's possible?

> > Srgio Penelc

> > Programador e Tcnico em Informtica
> > Web and Corp. Developer
> > PMS/SUCOM





> > * principal (first)

> > ICQ no. 56843734

> > SALVADOR/BAHIA



Thu, 16 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!
Aviel,

Your solution is SQL Server 7.0 specific. Unfortunately, Srgio did not specify
that he was using SQL Server 7.0.

---------------------------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc) which can be
cut and pasted into Query Analyzer is appreciated.


Quote:
> Very Simple:
> SELECT * TOP 15 FROM TABLE {WHERE...}



> > Not 100% sure about the DBMS you are using but select * from table where
> > rowcount > 15; Rowcount in oracle is a reserved oracle psuedo column .



> > > Hi everybody,

> > > I want to get only 15 records of the table.
> > > the query must have return only 15 records.

> > > It's possible?

> > > Srgio Penelc

> > > Programador e Tcnico em Informtica
> > > Web and Corp. Developer
> > > PMS/SUCOM





> > > * principal (first)

> > > ICQ no. 56843734

> > > SALVADOR/BAHIA



Thu, 16 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!
Srgio Penelc wrote the quoted material below:

" I want to get only 15 records of the table.
" the query must have return only 15 records.

SET ROWCOUNT=15
SELECT (whatever the select statement is)
SET ROWCOUNT=0

Be sure to reset the rowcount to 0 (which means to return EVERY row) or
every future recordset you receive on that connection will have only 15
rows.

This applies to SQL SERVER, which I'm assuming is the database you're
using, since you posted to a SQL Server newsgroup.

--
(C) 2000                      "You college degree is not a stopping point;
David Kaye                    it is just a hunting license for a job."  --
                                         Dr. Marty Nemko, career counselor



Fri, 17 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!
This is not SQL 7 specific, but perhaps Microsoft specific. The ANSI
standard says this is the answer

"The LIMIT TO nn ROWS clause used to limit the number of rows returned by a
query. You can use only the WHERE clause to limit the scope of a query."

Quote:

>Aviel,

>Your solution is SQL Server 7.0 specific. Unfortunately, Srgio did not
specify
>that he was using SQL Server 7.0.

>---------------------------------------------------------------
>BP Margolin
>Please reply only to the newsgroups.
>When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc) which
can be
>cut and pasted into Query Analyzer is appreciated.



>> Very Simple:
>> SELECT * TOP 15 FROM TABLE {WHERE...}



>> > Not 100% sure about the DBMS you are using but select * from table
where
>> > rowcount > 15; Rowcount in oracle is a reserved oracle psuedo column .



>> > > Hi everybody,

>> > > I want to get only 15 records of the table.
>> > > the query must have return only 15 records.

>> > > It's possible?

>> > > Srgio Penelc

>> > > Programador e Tcnico em Informtica
>> > > Web and Corp. Developer
>> > > PMS/SUCOM





>> > > * principal (first)

>> > > ICQ no. 56843734

>> > > SALVADOR/BAHIA



Fri, 17 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!

John,

You might want to also read your post ... your post did not use a LIMIT TO nn
ROWS clause, but a * TOP 15 clause which isn't even valid in MS SQL Server 7.0
... the correct syntax is TOP 15 *

---------------------------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc) which can be
cut and pasted into Query Analyzer is appreciated.

Quote:

> This is not SQL 7 specific, but perhaps Microsoft specific. The ANSI
> standard says this is the answer

> "The LIMIT TO nn ROWS clause used to limit the number of rows returned by a
> query. You can use only the WHERE clause to limit the scope of a query."


> >Aviel,

> >Your solution is SQL Server 7.0 specific. Unfortunately, Srgio did not
> specify
> >that he was using SQL Server 7.0.

> >---------------------------------------------------------------
> >BP Margolin
> >Please reply only to the newsgroups.
> >When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc) which
> can be
> >cut and pasted into Query Analyzer is appreciated.



> >> Very Simple:
> >> SELECT * TOP 15 FROM TABLE {WHERE...}



> >> > Not 100% sure about the DBMS you are using but select * from table
> where
> >> > rowcount > 15; Rowcount in oracle is a reserved oracle psuedo column .



> >> > > Hi everybody,

> >> > > I want to get only 15 records of the table.
> >> > > the query must have return only 15 records.

> >> > > It's possible?

> >> > > Srgio Penelc

> >> > > Programador e Tcnico em Informtica
> >> > > Web and Corp. Developer
> >> > > PMS/SUCOM





> >> > > * principal (first)

> >> > > ICQ no. 56843734

> >> > > SALVADOR/BAHIA



Fri, 17 Jan 2003 03:00:00 GMT  
 How to get only 15 records !!!

select top 15 * from dbo.yourtable

can slightly amend this to:

 select top 15 * from dbo.yourtable

in ADO

--
http://www.appfind.com/
the software development exchange


Quote:
> Hi everybody,

> I want to get only 15 records of the table.
> the query must have return only 15 records.

> It's possible?

> Srgio Penelc

> Programador e Tcnico em Informtica
> Web and Corp. Developer
> PMS/SUCOM





> * principal (first)

> ICQ no. 56843734

> SALVADOR/BAHIA



Sat, 01 Mar 2003 07:05:11 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. How to get only 15 records !!!

2. How to get only 15 records !!!

3. How to get only 15 records !!!

4. Adding 15 minutes

5. The Access Web-Updates (Feb 15, 1999)

6. Programmaticaly sending mail after only 15 minutes

7. Gung ho newbie - stuck at # 3 on the MVP - VBA basics in 15 minutes

8. Will January 15 be the final .NET-Day ?

9. How to schedule a service to poll every 15 minutes

10. need my users logoff automatically after 15 min

 

 
Powered by phpBB® Forum Software