Count query with 3 coloumn iin SQL
- by asher baig
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.MEDIENwhere verf1 != isbn;
Select COUNT(ISBN) as Ntverf2 FROM library.MEDIENwhere verf2 != isbn;
Select COUNT(ISBN) as Ntverf3 FROM library.MEDIENwhere 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