3
Answers

compare two table dispaly total distinct count

VINAY KUMAR

VINAY KUMAR

1y
452
1

we have two tables: table1 and table2

table1:-

id

tb1234

tb1236

tb1234

table-2

id

tb1234

tb1238

i want display only  total distinct recrords count only(tablae 1 and table 2)   like  3

iam using below query displays like 4

select  sum(tbl.AllCount)
From
(
select count(DISTINCT id) as AllCount from Table_1
UNION ALL
select count(DISTINCT id) as AllCount from Table_2
)tbl

plz help me

Answers (3)