Solution INSERT INTO destination_table (column names ) (select column names from the source_table ); e.g. INSERT INTO [dbo].[t_Menu] (Name,ParentId)VALUES ('CustomizedReports',(select id from t_Menu where Name='Reports')) go Explanation Here I have inserted the value in the same table, you can write name of the other table in select statement if you want to get from other... Continue Reading →
SQL Query Multiple Columns Using Distinct on One Column Only
Solution select ID, Category from t_Con_ChargesAmount where ID in (Select max(ID) FROM t_Con_ChargesAmount group by Category) Explanation This query will select ID and Category from the table and the Category will be distinct now.