Viewing 15 posts - 226 through 240 (of 1,923 total)
If you have excel, just create a visual representation of columns and the values you want to be in the rows (based off of your sample data) , copy the...
April 15, 2012 at 11:53 pm
THanks for posting the DDL and sample data; one last thing, can you please show us the expected result out of your sample data?
April 15, 2012 at 11:16 pm
I dont think we can control DST/GMT times. You will have to take the help of CLR functions to do the adjustments.
April 15, 2012 at 12:14 pm
User LEFT JOIN for the tables, dont use INNER JOIN.
April 13, 2012 at 1:02 pm
Can you set up the sample data in this readily usable format?
CREATE TABLE #Festival (
EventID [int] IDENTITY(1,1) NOT NULL,
[ID] [int] NULL ,
[EventType] varchar (50) NULL,
[EventTLocation] varchar (50)...
April 13, 2012 at 12:56 pm
Welcome to sqlservercentral.com! I see that you are very new to this site. Please take time to read the general forum etiquittes on how to post your question to milk...
April 13, 2012 at 12:23 pm
The query with and without the third join works fine for me! What is the error that you are seeing?
April 13, 2012 at 9:49 am
masonvann (4/12/2012)
Is that an alternative to PIVOT?
Yes! SUM(CASE...END) is an alternative to PIVOT. It is called as cross-tab . Read more about that in Jeff's article here http://www.sqlservercentral.com/articles/T-SQL/63681/
masonvann (4/12/2012)
April 13, 2012 at 12:28 am
A much better version:
SELECT
Male = SUM( CASE WHEN Person_Gender = 'Male ' THEN 1 ELSE 0 END )
,Female...
April 12, 2012 at 2:34 pm
It should be
Select [31] , [27]
from
(
SELECT occurrence_post, 1 as z
FROM tblPostOpOccurrences
) as s
PIVOT
(
SUM(z)
FOR occurrence_post IN ([31],[27])
)
as p
April 12, 2012 at 2:26 pm
THis?
SELECT Male = SUM (S.Male) ,Female = SUM(s.Female) ,Averg = MAX(s.Averg)
FROM
(
SELECT
Male = CASE WHEN Person_Gender = 'Male ' THEN...
April 12, 2012 at 11:04 am
Hi Rod,
I can visualize your question a bit, but can you please post some data and expected result in consumable format ?
Like given in the link below?
http://www.sqlservercentral.com/articles/Best+Practices/61537/
With 744 visits and...
April 11, 2012 at 3:37 pm
WHy dont u add the AVG statment in your inner query and use it as one of the columns in PIVOT Statement?
April 11, 2012 at 3:34 pm
First we should know what according to your system is considered as a junk character. With that, we have mechanisms to weed the rows that contain one or more junk...
April 11, 2012 at 12:53 pm
Something like this?
SELECT product_id
FROM <YOutable>
WHERE cat_id = 69
INTERSECT
SELECT product_id
FROM <YOutable>
WHERE cat_id = 30
Please read this artcile on multiple ways to do that
http://www.sqlservercentral.com/articles/T-SQL/88244/
The code i showed...
April 11, 2012 at 12:32 pm
Viewing 15 posts - 226 through 240 (of 1,923 total)