sql server - SQL where 1 column contains in two columns certain data -
sql server - SQL where 1 column contains in two columns certain data -
i have query like
select * datatable in (select from(subselect q) , b in (select b from(subselect q)
but won't want.
in result , b have in same row, can't figure out how this.
edit:
datatable: kundeversionid, zeitpunkt, kundeid 16, 2014-08-05 18:31:10.317, 10; 17, 2013-11-27 16:26:53.980, 11
select * datatable (zeitpunkt in (select zeitpunkt (select kundeid, max(zeitpunkt) zeitpunkt kundeversion grouping kundeid)as q) , kundeid in(select kundeid (select kundeid,max(zeitpunkt) zeitpunkt kundeversion grouping kundeid)as q)) order kundeid
hope helps
you can create subquery table in from
clause:
select * --todo - proper column list datatable dt inner bring together (select kundeid, max(zeitpunkt) zeitpunkt kundeversion grouping kundeid) q on dt.kundeid = q.kundeid , dt.zeitpunkt = q.zeitpunkt
sql sql-server subquery
Comments
Post a Comment