Viewing 15 posts - 1,261 through 1,275 (of 2,894 total)
September 6, 2012 at 10:48 am
cms9651 (9/6/2012)
The rule for the sorting is mat geographic NAME.MAW = My Area West
MAE = My Area East
MAC = My Area Center
MAS = My Area South
Oh, why we couldn't see...
September 6, 2012 at 10:23 am
... I am stumped on why that is not working...
Try to read other posts.
Any solution will be very limited to finding very simple queries and only in case if...
September 6, 2012 at 10:06 am
...
True but as I said there seems to be a bit of clarity needed on what the order should be. The MAT column is not ordered in the desired output.
then...
September 6, 2012 at 9:21 am
Richard Warr (9/6/2012)
September 6, 2012 at 9:19 am
Luis Cazares (9/6/2012)
Using Eugene suggestion (@index is declared int to prevent injection, but might create errors):...
[/code]
You don't need to worry about injection here, check this:
declare @index VARCHAR(100) = 'DROP EVERYTHING...
September 6, 2012 at 9:16 am
Sean Lange (9/6/2012)
...This query will produce the same results:
SELECT
COALESCE ([MAT], 'Tot') AS [MAT],
[DVD],
SUM ([SALES])
FROM
TestTable
GROUP BY
(MAT),
[DVD] --with rollup
ORDER BY
[DVD] DESC
...
Try to add one more data row:
INSERT INTO [dbo].[TestTable] ([MAT],...
September 6, 2012 at 9:10 am
You show in your setup that your table already holds the calculated Total record (looks like it is total per DVD). Then to sort results as you want you need...
September 6, 2012 at 9:06 am
MVDBA (9/6/2012)
Eugene Elutin (9/6/2012)
MVDBA (9/6/2012)
eugene... just out of interest... why avoid the windowing???Because using them may be slower then implementation without them...
hmmm.... yes, but also alternate solutions might use other...
September 6, 2012 at 8:45 am
Phil Parkin (9/6/2012)
mssqlsrv (9/6/2012)
I think you can not use variable in order by clause.Variables are only allowed when ordering by an expression referencing a column name.
Yeah you can. Just tried...
September 6, 2012 at 8:41 am
I wonder what we are rally discussing here?
There are many different ways to remove duplicate data. Decision on which one to use will depend on exact situation. Sometimes, you...
September 6, 2012 at 8:08 am
MVDBA (9/6/2012)
example 2 wont work -you'll end up with a table called demo1 not demo
Are you serious? :w00t:
It is just an EXAMPLE 🙂
So, I've named the table in a second...
September 6, 2012 at 7:57 am
MVDBA (9/6/2012)
eugene... just out of interest... why avoid the windowing???
Because using them may be slower then implementation without them...
September 6, 2012 at 7:56 am
Luis Cazares (9/6/2012)
IMO, different queries, same result. Just like:SELECT CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) AS one
and
SELECT 1 one
Very arguable! And not very good example.
In my case queries are exactly the...
September 6, 2012 at 7:54 am
Luis Cazares (9/6/2012)
It's not the same thing to have
SELECT col1 FROM TableA
or
SELECT a.col1 AS mycol FROM TableA a
Even comments would make a query...
September 6, 2012 at 7:39 am
Viewing 15 posts - 1,261 through 1,275 (of 2,894 total)