Re: Re[sqlite] trieving only one record in the database

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Re[sqlite] trieving only one record in the database

Eric Pankoke
You could do

SELECT whatever FROM table WHERE criteria LIMIT 1

or

SELECT COUNT(*) AS RowCount FROM table WHERE criteria

Then just check that the value of RowCount > 0.  The nice thing about the latter is that now you are set up if you ever want to know how many rows meet the criteria that you've chosen.

--
Eric Pankoke
Founder / Lead Developer
Point Of Light Software
http://www.polsoftware.com/

 -------------- Original message ----------------------
From: arbalest06 <[hidden email]>

>
> Good day!
>
> I want to retrieve only one record in the database with a condition that may
> cause a retrieval of many records. The purpose of this is for me to check
> only if there is at least 1 record in the database. So if given my
> condition, the query would now search for one record in the database that
> satisfies the condition the returns that record. After one record is found,
> it should now stop finding and retrieving other records that satisfies the
> condition. How can i do this? What query can i issue?
>
> Thank you and God bless!
> --
> View this message in context:
> http://www.nabble.com/Retrieving-only-one-record-in-the-database-tp15087994p1508
> 7994.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
>
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [hidden email]
> -----------------------------------------------------------------------------
>


-----------------------------------------------------------------------------
To unsubscribe, send email to [hidden email]
-----------------------------------------------------------------------------