hi, i have a table with many columns. in one column there are time values and in an other column there are characters like a and b. this means a time depends a and th other depends b. i want a view with two columns at column a there will be a values and in b column there will be b values. is it possible
OK, here's a quick & dirty script that shows something like what I think you're after: DECLARE @foo TABLE (RowID INT IDENTITY, CharField CHAR(1), TimeField DATETIME) INSERT INTO @foo (CharField, TimeField) SELECT 'a',GETDATE() UNION ALL SELECT 'b',GETDATE()-1 UNION ALL SELECT 'a', GETDATE()+1 SELECT *, CASE WHEN charfield='a' THEN Timefield ELSE NULL END AS TimeA, CASE WHEN charfield='b' THEN Timefield ELSE NULL END AS TimeB FROM @foo Run that code and you'll see a column TimeA that contains the TimeField value only when the CharField value is 'a', and TimeB when charfield value is 'b' That final `SELECT` - that's the bit you'll need to alter to suit your requirements. When you've got that working as you require, then wrap it in a `VIEW`.