Skip to content

Tag: sql

SQL to generate %, n and N from the datatable

I seek your help in generating a summary query result as %, n (numerator), and N (Denominator) out of a variable in the dataset for each underlying category: e.g: data sr.no. is_healthy 1 yes 2 no 3 yes 4 no 5 yes 6 yes 7 no 8 yes 9 no 10 yes I expect the following as a summary result

Remove “” from string or in SQL varchar

Is it even possible to return value of string without the ” ” ? I have the following string: Chb = “NOT”; Now i either want to remove the “” in C# or SQL. so i want to have either Chb = NOT in C# ,or i want to remove the ‘ ‘ in SQL that i get in @Chb

SQL Where clause order

I have this SQL query: It runs fine and displays the expected result without the WHERE line, but I do need to filter the resultant data as that would imply. The error I’m getting is Invalid Column Name ‘FileCount’ after the WHERE keyword. I’ve been reading around and I can’t find…

SQL query to filter columns

I have a question regarding the SQL query. I have this table shown below Region Rep Item Quebec Jones Pencil Ontario Kivell Binder Ontario Jardine Pencil Ontario Gill Pen Alberta Sorvino Pencil Quebec Jones Binder Ontario Andrews Pencil Ontario Jardine Pencil Alberta Thompson Pencil Quebec Jones Binder Ontari…