Query (find max from two table resultant row should be single in sql 2005)
-
Dear friend I want to write a query that produced single row find the max form two table and also query that delete all redundant data from table in sql 2005 Thanks and regards Azad Yadav
-
Dear friend I want to write a query that produced single row find the max form two table and also query that delete all redundant data from table in sql 2005 Thanks and regards Azad Yadav
azad yadav wrote:
write a query that produced single row find the max form two table
you can get max for each table and then find max from two result . same as this code:
select max(twotable.fieldmatch) from
(
select max(field1) as fieldmatch from table1
UNION
select max(field1) as fieldmatch from table2
)twotableazad yadav wrote:
query that delete all redundant data from table in sql 2005
This is a general question , you must specify what you mean exactly.
Human knowledge belongs to the world http://www.rad.pasfu.com/index.php
-
Dear friend I want to write a query that produced single row find the max form two table and also query that delete all redundant data from table in sql 2005 Thanks and regards Azad Yadav
one thing between two table should have delete cascading on master table . then u can use delete from mastertable where id = select top 1 id from (select max(id) as id from master a join detail b on a.id=b.id )as a