Viewing 7 posts - 1 through 7 (of 7 total)
hoo-t's reply is the best way to do it for a result set.
However, If you want it as a single continuous result, then try this:-
--create test table and populate...
April 7, 2004 at 12:02 pm
Or something like this :- Which does away with the extra join and the group by
SELECT p.EmployeeID, p.LastName, p.FirstName, p.UpdDate
FROM Personnel p
where p.UpdDate=(Select max(Upddate) from Personnel x where p.EmployeeID = x.EmployeeID)
March 12, 2004 at 1:07 am
The order by forces SQL Server to create a temptable. If your column NEWID is unique and incremental, why don't you generate a random number within it's range,pass it...
October 31, 2003 at 12:47 am
One other way to write this sort of query - which I find to be a very useful technique is :-
CREATE PROCEDURE au_info @lastname varchar(40), @firstname varchar(20) AS
SELECT au_lname,...
October 17, 2003 at 7:08 am
Why don't you compile the Sql and then exec it into a temp table - do your cursor select against the temp table - run the cursor. Then truncate...
October 16, 2003 at 12:58 am
It depends on the purpose of your SQL, but, why don't you consider writing a View that unions all the data from the similarly structured tables - you can then...
October 15, 2003 at 1:29 am
A bit of a bodge, I know, but you could do :-
declare @header varchar(50)
set @header = 'TestColumn'
select @header
union
select convert(varchar(10),1)
order by 1 desc
It would mean that you'd have to do converts...
April 26, 2002 at 2:12 am
Viewing 7 posts - 1 through 7 (of 7 total)