Hi All,

I have a sql query i am trying to get the count of how rows it returned.

select a.field1,
       b.field2,
       c.field2
       from table1 as a,
            table2 as b,
            table2 as c
        where a.field1=b.field1

Considered the above query return 9 rows. I want to get count of '9' in a mysql query. Please help. Thanks in advance.

select count(*)
   from table1 as a,
        table2 as b,
        table2 as c
    where a.field1 = b.field1

@pritaeas thanks, I am using the below query as well to get the same.

select count(*) as `count` from  (
select a.field1,
   b.field2,
   c.field2
   from table1 as a,
        table2 as b,
        table2 as c
    where a.field1=b.field1 ) tbl
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.