Viewing 15 posts - 1,996 through 2,010 (of 3,957 total)
vinu512 (2/7/2013)
--Creating Table
Create Table Ex1
(
Id Int Identity(1,1),
AllLevels Varchar(MAX)
)
--Inserting Sample...
February 8, 2013 at 1:07 am
akberali67 (2/8/2013)
I understood the issue, it is with the concept. Mathematically, it needs more theories (Permutations, Combinations and Selections) implemented within code, I will have to buy books and read...
February 8, 2013 at 12:55 am
Generating random numbers is way too important to leave to chance!
Hence I refer you to the second link in my signature articles. 😀
In that article, you will find a FUNCTION...
February 7, 2013 at 10:31 pm
That's a lot of sample data! Let's look at just the first 4 rows:
;WITH SampleData
([Customer ID], Var1, Var2, Var3, Var4, Var5, Var6, Var7, Var8, Var9, Var10, Var11, Var12, Var13,...
February 7, 2013 at 10:12 pm
akberali67 (2/7/2013)
This is so amazing, I mean I ran it on a smaller dataset but this works great. I have tried SAS, R, MATLAB over the past month but I...
February 7, 2013 at 9:19 pm
Sri8143 (2/7/2013)
I thought i was good at writing SQL queries but not anymore ..I guess i was much of thinking on how to acheive the result set...
February 7, 2013 at 9:00 pm
ashishjain (2/6/2013)
You can use below code to perform this operation:
create table test99 (column1 int, column2 int, result int)
insert into test99
values
(50,1500,0),
(100,0,0),
(40,0,0),
(30,0,0)
declare @col2 int = 1500
select * from test99
update test99
set @col2...
February 7, 2013 at 8:11 pm
Further to what Phil and Anthony said, you need to show your expected results exactly as they should be derived from your sample data.
Otherwise we're not going to know how...
February 7, 2013 at 8:01 pm
Something like this perhaps?
SELECT id
,Email=MAX(CASE Typeid WHEN 1 THEN Contact END)
,EmailType=MAX(CASE Typeid WHEN 1 THEN TypeID END)
,EmailStatus=MAX(CASE Typeid...
February 7, 2013 at 7:58 pm
Here's another option using window aggregate functions:
;WITH SampleData ([Group], [Type], Amount) AS (
SELECT 'Dog', 'Typea', 1 UNION ALL
SELECT 'Dog', 'Typeb', 2 UNION ALL
SELECT 'Dog', 'Typec', 3 UNION ALL
SELECT 'Cat', 'Typea',...
February 7, 2013 at 7:01 pm
wafw1971 (2/6/2013)
Hi PhilThanks for you replies, the calendar template option will be something I will use in the future but I would like to learn about loops.
Wayne
Better advice is learn...
February 7, 2013 at 6:32 pm
You just need to add a few columns to the query I provided:
;WITH AllCustomers AS (
SELECT *
,n=ROW_NUMBER() OVER...
February 7, 2013 at 6:26 pm
asco5 (2/7/2013)
so i need to know the top 100 of poeple who have the most entry
How do you want to handle tied counts?
I'm thinking a RANK() or DENSE_RANK() might be...
February 7, 2013 at 6:16 pm
How about something like this to avoid the self-join? Uses Sean's setup data.
SELECT Div_time, Unit_id
,TimeDifferenceMin=DATEDIFF(minute, MIN(Filled_Time), MAX(Filled_Time))
FROM #Something
GROUP BY Unit_id, Div_time
HAVING MAX(Filled_Time) <> MIN(Filled_Time)
Edit: Added...
February 7, 2013 at 6:11 pm
GordonLiddy (2/7/2013)
Is there an easy way to pivot data into another table, when the design of the first table is something like this:
ColumnProperty (nvarchar(nn))ColumnValue (sql_variant)
=========================
Name ...
February 7, 2013 at 6:01 pm
Viewing 15 posts - 1,996 through 2,010 (of 3,957 total)