Skip to content

Tag: sql-server

Joining multiple tables in SQL

Can sombody Explains me about joins? Inner join selects common data based on where condition. Left outer join selects all data from left irrespective of common but takes common data from right table and vice versa for Right outer. I know the basics but question stays when it comes to join for than 5, 8, 10 ta…

How to kill/stop a long SQL query immediately?

I am using SQL server 2008 and its management studio. I executed a query that yields many rows. I tried to cancel it via the red cancel button, but it has not stopped for the past 10 minutes. It usually stops within 3 minutes. What could the reason be and how do I stop it immediately ? Answer What could

check if the column value exists in subquery

i have 3 tables Product Category and ProductCategory. Product table: Category table: ProductCategory: I need a query which returns products which fall under more than 1 categories. Based on the table data above the result would be: So i wrote a query to fetch all the ProductID’s which have more than one…

query for first and last day of month

If I have the name of the month, how can I have the first and last day of that month in SQL? I have this query to returns the month names: Result: Now, how can i get the first and last day of that months? changing the query. Answer Try this :- Result :- Result obtained taking the help from