Viewing 15 posts - 901 through 915 (of 1,183 total)
WITH yourCTEname
AS
(SELECT
CustID
,MAX(OrderDate) AS [Last Order]
FROM Orders
WHERE CustID
GROUP BY CustID)
SELECT
ID,
CustName,
FROM Customers
LEFT JOIN...
October 4, 2007 at 9:27 am
....but something tells me there's an easier way.
September 27, 2007 at 10:24 am
Include another set of joins...
SELECT
pr.parentprodnodeid
,pr.childprodnodeid
,po.prodnodeid
,pc.sysclassname AS [Parent Class]
,cc.sysclassname AS [Child Class]
FROM
productrelationships pr
LEFT JOIN productobjects po
ON pr.parentprodnodeid = po.prodnodeid
LEFT JOIN productclasses pc
ON po.prodclassid = pc.prodclassid
LEFT JOIN productobjects co
ON pr.childprodnodeid...
September 27, 2007 at 10:23 am
The "Hitchhikers Guide to SQL Reporting Services 2000" is a great book. Although it's for 2000, a lot of it is still applicable.
September 27, 2007 at 6:49 am
[p]WITH
problem (problem_name, kount)
AS (SELECT
problem_name = pr.name
...
September 26, 2007 at 12:21 pm
Well, poo! I wasn't thinking of it that way. Of course, if you need info from both CTE's then you'll need to join them in the last select.
September 26, 2007 at 12:06 pm
No, CTE's are only available to the statement immediately following them.
you will want to use a table variable instead.
September 26, 2007 at 11:47 am
But I like random, it's rather difficult to disprove random results... :hehe:
September 26, 2007 at 7:10 am
Change "transactionDate" to "Spend DESC" in my code and you should get what you need.:D
September 26, 2007 at 6:53 am
First you want to get away from procedural thinking. SQL works best set based. Also, post the DDL for your tables, it makes it easier for people to respond with...
September 26, 2007 at 6:23 am
Andras is correct. And easy way to do this would be to throw your PIVOT into a CTE and then you can call it twice in the union.
September 24, 2007 at 9:34 am
You simply put the name of your dataset or group in place of SCOPE. This will return the number of rows in the dataset or group. You do not need...
September 24, 2007 at 9:30 am
It's a little confusing. I'm still not 100% on them (pivot and unpivot) but it's beginning to get clear. DONT ASK ME TO EXPLAIN.. *laughs*
But as you can see the...
September 13, 2007 at 7:30 pm
Simply put, each row from one table is returned with each row from the second or a Cartesian Product is the result set. So if each table has 10 rows,...
September 13, 2007 at 10:48 am
Viewing 15 posts - 901 through 915 (of 1,183 total)