Count query with 3 coloumn iin SQL
Posted
by
asher baig
on Stack Overflow
See other posts from Stack Overflow
or by asher baig
Published on 2012-11-05T16:58:36Z
Indexed on
2012/11/05
16:59 UTC
Read the original article
Hit count: 322
I have one database Library with table named called Medien. Having multiple columns named as Fname,Mname,Lname and ISBN.
I want to calculate database records with ISBN and without ISBN?
I have execute following command
- Select COUNT(ISBN) as Verf1 FROM
library
.MEDIEN
where verf1 =isbn
; - Select COUNT(ISBN) as Verf2 FROM
library
.MEDIEN
where verf2 =isbn
; - Select COUNT(ISBN) as Verf3 FROM
library
.MEDIEN
where verf3 =isbn
; - Select COUNT(ISBN) as Ntverf1 FROM
library
.MEDIEN
where verf1 !=isbn
; - Select COUNT(ISBN) as Ntverf2 FROM
library
.MEDIEN
where verf2 !=isbn
; - Select COUNT(ISBN) as Ntverf3 FROM
library
.MEDIEN
where verf3 !=isbn
;
I am not sure i execute correct command or not. Because some ISBN records have Fname,Mname or Fname,Lname or Mname,Lname or Fname , Lname,Mname only respectively.
Please kindly help me solving this query
© Stack Overflow or respective owner