How to count data from multiple table in a single query

As a developer, We need to count rows  from multiple table in a single query.

In this tutorial, I will show you how can you do that –

I am writing it Codeigniter format, but you can use this query in procedural way.


$query = "SELECT (SELECT COUNT(id) FROM table1) AS num1,
(SELECT COUNT(id) FROM table2) AS num2,
(SELECT COUNT(id) FROM table3) AS num3";
$result = $this>db->query($query)->row();

You can also use where condition here to get more necessary info..

Don’t be afraid to say “no”

Saying no is hard, especially if you’re like me—you’re generous and want people to feel happy working with you. You don’t want to disappoint anyone, so you offer to help any way you can, not really considering the strenuous load it’ll put on you.

No matter what you do, you’ll disappoint someone. Whether it be the client because you’re unable to deliver halfway through the project, your family because you’re working long hours, or yourself because you’re so stressed with the work you’ve chosen to take on. So you must get comfortable with turning down work if it’s ultimately not for you or your availability. To help determine if you should take on a project, ask yourself these questions:

  • Do I specialize in the work that’s needed by this client?
  • Why am I taking this project on? Is it a commitment I should be making?
  • Why am I adding that project onto my plate?

The worst thing about taking on everything that comes your way is that your plate may end up full, but with all of the wrong commitments. You’re stressed, anxious, and the worst part, now you’re left with no room to take on that golden opportunity. You can’t say yes to your ideal client if you never say no to the wrong ones.

Next time you get a project, don’t just reply with a yes. Really consider the opportunity, ask yourself those questions above, and proceed with a conscious decision for your future and well being.

Software Development

Software Development

We are a progressive software development company in Bangladesh. We build quality software. We develop software for Envato, Codester and Custom Customer. We help our customers build customized software – everything from web to desktop to enterprise to mobile and beyond.

We hire only the best. Our culture helps us retain our talents and our skill development programs ensure that we are always on the top of recent developments. Whether they are in, mobile application development or building web apps or custom desktop tools, our clients get top professionals working for them,

Our costs are typically less than 30% of similar service costs from the others. Contact us for any custom software development.

Search Engine Optimization(SEO)

Search Engine Optimization(SEO)

What is Search Engine Optimization (SEO)?
SEO is a marketing discipline focused on growing visibility in organic (non-paid) search engine results. SEO encompasses both the technical and creative elements required to improve rankings, drive traffic, and increase awareness in search engines. There are many aspects to SEO, from the words on your page to the way other sites link to you on the web. Sometimes SEO is simply a matter of making sure your site is structured in a way that search engines understand.

SEO isn’t just about building search engine-friendly websites. It’s about making your site better for people too.

Point Of Sale

Point Of Sale

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes