SQLTeam.com | Weblogs | Forums

How to join two table in single query

Hi, is it possible to join two table with different statement? i know a little bit about join but now sure how to join this two statement.

select count(*) as total_farmer from profile_farmer
select sum(area_accepted) as total_area from lot_farmer

Thanks

you can join using the common column which is present in both the tables.
something like farmer_id

thank you for your reply. is the query will look like this?

select count(*) as total_farmer from profile_farmer a join lot_farmer b on a.farmer_id = b.farmer_id

how do i make the output for total farmer and total area? sorry for the trouble. im weak in joining two table.

can you try this
select count(a.farmer_id) as total_farmer,
sum(b.area_accepted) as total_area from profile_farmer a
join lot_farmer b
on a.farmer_id = b.farmer_id