Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dividing SQL Results...

Status
Not open for further replies.

cranebill

IS-IT--Management
Jan 4, 2002
1,113
US
Just experimenting with SQL and was trying something new.

How can I get the answer to this with SQL:

Select Count(*) From Table A

Divided by

Select Count(*) From Table B

to create a percentage?

I have 2 complex queries and the above is just used as examples but am trying to determine sales percentages.

Thanks

 
Code:
select ( select count(*) from a ) / ( select count(*) from b );

You need a version of mysql that does subqueries.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top