sql server - Match two tables and return the result table in sql -
i have following 2 tables in sql server.
table : 1
no items 1 70 2 72 3 74 table : 2
name type date abc 70 12/12/2013 01:10 xyz 70 12/12/2013 10:10 bcd 74 10/12/2013 08:10 efg 74 10/12/2013 09:10 jkl 70 01/01/2012 23:10 now want following result:
result :
chk name type date 1 xyz 70 12/12/2013 10:10 1 efg 74 10:12/2013 09:10 0 abc 70 12/12/2013 01:10 0 bcd 74 10/10/2013 08:10 0 jkl 70 01/01/2012 23:10 i want latest entries of each type table: 1 on top chk = 1 in table : 2 in result table.
now want write sql query find out above result. can me write sql query same?
something along lines of
select t1.no chk, t2.name, t2.type, t2.date [date] table1 t1 inner join table2 t2 on t1.items = t2.type group t1.no, t2.name, t2.type, t2.date order t1.no desc (without typing myself in mgmt studio 'off')
Comments
Post a Comment