|
|
select ●全行数 from
-- ここからインラインビュー
(select count(*) as ●全行数,1 as SORT from 郵便番号マスタ
union all
select '●重複しない件数',2 as SORT from コントロールマスタ
union all
select count(*),3 as SORT from
(select distinct 郵便番号 from 郵便番号マスタ)
)
-- ここまでインラインビュー
order by SORT
| |
|
|
|
|
select [●全行数] from
-- ここからインラインビュー
(select convert(varchar,count(*)) as [●全行数],1 as ソート
from 郵便番号マスタ
union all
select '●重複しない件数',2 as ソート
union all
select convert(varchar,count(distinct 郵便番号)),3 as ソート
from 郵便番号マスタ) as INVIEW
-- ここまでインラインビュー
order by ソート
| |
|
|
|
|
select count(*),1 as `ソート` from 郵便番号マスタ
union all
select count(distinct 郵便番号),3 as `ソート` from 郵便番号マスタ
| |
|
|
select '●全行数',1
union all
select count(*),2 from 郵便番号マスタ
union all
select '●重複しない件数',3
union all
select count(distinct 郵便番号),4 from 郵便番号マスタ
order by 2
| |
|
|
select `●全行数` from
-- ここからインラインビュー
(select count(*) as '●全行数',2 as `ソート` from 郵便番号マスタ
union all
select '●重複しない件数',3
union all
select count(distinct 郵便番号),4 from 郵便番号マスタ) as INVIEW
-- ここまでインラインビュー
order by `ソート`
| |
|
↓インラインビュー部分の実行( 但し、MySQL4.0 の為結果が少し違います。また、インラインビューは使えません )
|
|
|
select "●全行数" from
-- ここからインラインビュー
(select
TO_CHAR(count(*)) as "●全行数",1 as ソート
from 郵便番号マスタ
union all
select '●重複しない件数',2 from dual
union all
select
TO_CHAR(count(distinct 郵便番号)) as "●重複しない件数",3
from 郵便番号マスタ)
-- ここまでインラインビュー
order by ソート
| |
|
|
|
|
select "●全行数" from
-- ここからインラインビュー
(select
TO_CHAR(count(*),'FM9999999999') as "●全行数",1 as ソート
from 郵便番号マスタ
union all
select '●重複しない件数',2
union all
select
TO_CHAR(count(distinct 郵便番号),'FM9999999999') as "●重複しない件数",3
from 郵便番号マスタ) as INVIEW
-- ここまでインラインビュー
order by ソート
| |
|
|
|