Rich Shepard <[EMAIL PROTECTED]> wrote:
  Is this the correct syntax to return records only if there are rows
of data in the table?

select * from component where exists (select * from component where
category='natural')
  What I'm trying to do is load data into a GUI widget only if it
exists.
  Is is more parsimonious to use only the second 'select' and assume
that no records means nothing to be displayed?

It is not equivalent. Your original query returns all rows in the table (with category='natural' or otherwise) as soon as there is at least one row with category='natural'. In other words, if there are 11 rows in the table - one with category='natural' and ten with some other category value - your query will return all 11 of them. In the same situation, the second select will return just one row. It's not quite clear which way you want it.

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to