---
title: "Getting table data with total counts"  
description: "Getting table data with total counts"  
author: "Anonymous User"  
published: 2013-05-18  
updated: 2013-05-18  
canonical: https://www.mindstick.com/forum/906/getting-table-data-with-total-counts  
category: "mysql"  
tags: ["mysql"]  
reading_time: 1 minute  

---

# Getting table data with total counts

Hi Mindstickians!\
I am having following [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) ([student](https://www.mindstick.com/articles/157138/student-loan-default-wage-garnishment-and-student-loan))\
sid sname [branch](https://answers.mindstick.com/qa/41075/why-did-the-continental-congress-adopt-the-olive-branch-petition) semester 1 Vijay [CSE](https://answers.mindstick.com/qa/37167/is-cse-a-good-choice-for-people-who-love-mathematics) 6 2 Ajay MECH 4 3 Riteh CSE 6 4 Nutan CSE 6 5 Riya ETC 4 6 Ritu CSE 6 \
Here I want to [fetch](https://www.mindstick.com/forum/156159/what-is-google-fetch) all record and total fetched record [count](https://www.mindstick.com/forum/157774/selecting-count-with-distinct) for that i'm using following [query](https://www.mindstick.com/blog/202/sub-query-in-sqlserver), but this is not able to fetch all [records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records)\
[select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) *,count(sid) from [students](https://www.mindstick.com/articles/13083/benefits-of-students-who-can-get-online-assignment)How can we do this?\
Please help!Thanks in advance. \

## Replies

### Reply by AVADHESH PATEL

Hi Tanuj!\
You can achieve as following using sub query \
select *,(SELECT COUNT(*) FROM students) totalCOunt from studentsusing CROSS JOIN\
select a.*, b.totalCOunt from students a, (SELECT COUNT(*) totalCOunt FROM students) b\
It may be helpful for you.


---

Original Source: https://www.mindstick.com/forum/906/getting-table-data-with-total-counts

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
