sql - Compare to all columns -
is possible compare vector of values columns of table in sql, more in ms sql server?
for example, have table, example, 3 columns:
example: cola, colb, colc
and want check if columns match specific vector: ('val0', 'val1', 'val2')
i know can sentence this:
select * example cola='val0' , colb = 'val1' , colc = 'val2'
but i'd know if there function, allequal allow me like:
select * example allequal('val0', 'val1', 'val2');
i understand if function exists syntax may quite different between different rdbmss , focused on ms sql server. nevertheless more happy if can give me examples in other databases managers.
declare @foo table ( cola int, colb int ); insert @foo ( cola, colb ) values ( 1, 1 ), ( 1, 2 ), ( 2, 1 ); select * @foo; select * @foo intersect select * ( values ( 2, 1 ) ) bar( cola, colb );
Comments
Post a Comment