Viewing 15 posts - 10,411 through 10,425 (of 15,381 total)
As Michael said you need the TOP when using a derived table and an ORDER BY.
What I don't understand is why there is a need to have an order by...
October 10, 2012 at 2:09 pm
yogi123 (10/10/2012)
Sean Lange (10/10/2012)
However, it seems you want the most recent date...
October 10, 2012 at 2:03 pm
This looks a lot like homework. We don't typically provide answers for homework because we want you to learn.
However, it seems you want the most recent date prior to the...
October 10, 2012 at 1:52 pm
Here is an example of one way of deleting duplicates. There are plenty of other ways to do this.
create table #Dupes
(
IdentityValue int identity not null,
UserValue varchar(20),
AnotherValue varchar(10)
)
insert #Dupes
select 'asdf', 'Another'...
October 10, 2012 at 1:45 pm
Not 100% sure what you are trying to do here. It sounds like you want to delete duplicates from a table? This seems like an awfully complicated way to go...
October 10, 2012 at 1:02 pm
hillerz19 (10/10/2012)
I am a new to SQL. And i try doing looking at a book but gives me error and lots of it. i am not sure how...
October 10, 2012 at 12:17 pm
This looks a LOT like homework. What have you tried? What do you think you need to change?
October 10, 2012 at 10:45 am
Without something to work with it is impossible to know what you are doing here. You said you have repeated data but there are no duplicate rows in your result...
October 10, 2012 at 10:35 am
Eskandari (10/10/2012)
CREATE TABLE Test ( field_one nvarchar(10) );
DECLARE @i int;
WHILE @i<= 1000
BEGIN
...
October 10, 2012 at 8:39 am
As Stewart said that will only work for single row updates but it also will fail if the table is empty. The values you are getting into your variables are...
October 10, 2012 at 8:35 am
To get the count of cities for each state you need to remove City from the select list.
SELECT [State]
,COUNT(DISTINCT[City]) AS City_Cnt
FROM [dbo].[MySalesDataTableAggregatedMonthly]
WHERE [State] IS NOT NULL AND [City] IS NOT...
October 10, 2012 at 8:30 am
Be careful with approach. Deleting tables just because they haven't been used in a couple months can very likely come back to bite you. What about reports that are only...
October 10, 2012 at 8:26 am
jbalbo (10/10/2012)
I ran an update on one record to update the datetime using current_timestamp
I might be losing it...
but before the update when I looked at a date/time field its looked...
October 10, 2012 at 8:20 am
sqlstud (10/10/2012)
I have table "Trial1"
One of the columns is
DATERECEIVED DATETIME NULL
Loading data from Excel to staging table using ssis 2005.
Datareceived column contains data as below
17/12/2010
18/12/2011
DECLINED
NULL
I need to load...
October 10, 2012 at 8:15 am
nitin.varshney (10/10/2012)
October 10, 2012 at 8:12 am
Viewing 15 posts - 10,411 through 10,425 (of 15,381 total)