An efficient method would be to have indexes on both columns, and
consider it perform two separate queries which can be handled
transparently at the database level as follows:

SELECT
  (SELECT COUNT(*) from motels where breakfast_available=1) AS
breakfast,
  (SELECT COUNT(*) from motels where conference_available=1) AS
conference
WHERE 1;



On Feb 13, 9:52 pm, renjith das <[email protected]> wrote:
> Hi
>
>        select count(*) from motel where breakfast_availabel = 1
> UNION
> select count(*) from motel where conference_availabe = 1
>
>             I think this query will be helpful for you
>
> Regards
> Renjith
>
> On Fri, Feb 13, 2009 at 5:12 PM, Olivia Brown <[email protected]> wrote:
> > Hi,
>
> > I have a MySql database that contains a 'motels' table. One of the fields
> > in the table is 'breakfast_available' and this contains an integer (1 for
> > yes, 0 for no)
> > The other field in this table is 'conference_facilities' which also stores
> > an integer value 1 or 0 like the other field above.
>
> > I would like to setup one MySql query that will display this number of
> > motels have breakfast available (breakfast_available = 1) and this number of
> > motels provide conference facilities (conference_facilities = 1)
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to