Viewing 15 posts - 1 through 15 (of 24 total)
Please try:
SELECT mst.CICS_DIM.CUST_KEY
FROM mst.CICS_DIM
INNER JOIN stg.STG_CUSTOMER_INTEG
ON mst.CICS_DIM.CUST_CICS_ID = STG_CUSTOMER_INTEG.CUST_CIS_ID
INNER JOIN SOURCE_SYSTEM_REF
ON mst.CICS_DIM.SRC_SYS_KEY = SOURCE_SYSTEM_REF.SRC_SYS_KEY
AND SOURCE_SYSTEM_REF.SRC_SYS_ID IN ('CIS','CRD','CSS','WST','VSA')
INNER JOIN stg.CONTROL_RUN
ON mst.CICS_DIM.TRANS_END_DT = CONTROL_RUN.PROC_END_DT
AND mst.CICS_DIM.TRANS_EFF_DT <= CONTROL_RUN.PROC_EFF_DT
February 13, 2009 at 11:53 am
Utilizing code posted by Mark:
SELECT Emp, Id, MIN(Date) BlockStart, MAX(Date) BlockEnd, COUNT(*) AS NumberInBlock
FROM (SELECT Emp, Date, Id
,(SELECT COUNT(1) FROM dbo.Test t2
...
February 11, 2009 at 9:12 pm
Please try:
CREATE TABLE #Test (
MyChar1 varchar(10) NOT NULL,
ApplID varchar(10) NOT NULL)
CREATE TABLE #ErrorHistory (
ApplID varchar(10) NOT NULL,
...
February 11, 2009 at 8:09 pm
This might help:
-- populating test data
DECLARE @matltran TABLE (trans_num INTEGER IDENTITY
,item NVARCHAR(30)
,qty DECIMAL(18,8)
,cost DECIMAL(18,8))
DECLARE @x TINYINT
SET @x = 1
WHILE @x < 200
BEGIN
INSERT INTO @matltran (item, qty, cost)
SELECT 'Test1', 5.5, 0.7
UNION...
February 6, 2009 at 10:05 pm
Please try:
SELECT [Process_ID]
,[User_ID]
,[Pat_ID]
FROM ACCESS_LOG
WHERE Process_ID NOT IN (SELECT Process_ID
...
February 6, 2009 at 3:04 pm
Yes, Ramesh is right, it should be > 2
February 6, 2009 at 9:19 am
Try:
SELECT dbo.forum.Product
,dbo.forum.Supplier
,dbo.forum.SupplierCrossReference
,dbo.forum.DateLastQuoted
FROM dbo.forum
WHERE SupplierSequence = '500'
...
February 6, 2009 at 8:43 am
Please try (but if values in DateLastQuoted are the same it will update all records with the DateLastQuoted):
UPDATE dbo.Forum SET SupplierSequence = '500'
FROM dbo.Forum f1
INNER JOIN (SELECT Product, MAX(DateLastQuoted) DateLastQuoted
FROM...
February 5, 2009 at 2:48 pm
Please try:
DECLARE @test-2 Table (UserID INT, UserName VARCHAR(50), billed BIT, grossamt MONEY)
INSERT INTO @test-2 (UserID, UserName, billed, grossamt)
SELECT 30681,'Smith Jane',0,1500.40 UNION ALL
SELECT 30681,'Smith Jane',0,26.00 UNION ALL
SELECT...
January 20, 2009 at 12:03 pm
Please try:
SELECT @Count = COUNT(DownloadID)
FROM dbo.tblDownload
WHERE VendorID = @VendorID
AND (@Action NOT IN (‘a’,’b’)
OR (@Action = ‘a’ and DownloadStatusID IN (1,2))
...
January 13, 2009 at 7:53 pm
Maybe this will help: (based on http://www.sqlservercentral.com/articles/XML/61618/)
DECLARE @test-2 TABLE (t1 VARCHAR(100))
INSERT INTO @test-2
SELECT 'Value1,Value2' UNION ALL
SELECT 'Value2' UNION ALL
SELECT 'Value2,Value3'
--IF more than 2 values per row...
January 13, 2009 at 2:36 pm
Please try:
SELECT ProductId
,COUNT(1) OrderCount
,CASE WHEN COUNT(1) = 1 THEN SUM(MAN)/NULLIF(SUM(MANCount),0) ELSE AVG(MAN) END MAN
,CASE WHEN COUNT(1) = 1 THEN SUM(PUR)/NULLIF(SUM(PURCount),0) ELSE AVG(PUR) END PUR
...
January 13, 2009 at 8:22 am
Please try:
SELECT ProductId
,COUNT(1) OrderCount
,CASE WHEN COUNT(1) = 1 THEN SUM(MAN)/MANCount ELSE AVG(MAN) END MAN
,CASE WHEN COUNT(1) = 1 THEN SUM(PUR)/PURCount ELSE AVG(PUR) END PUR
FROM...
January 9, 2009 at 11:33 am
yes, you are right, it should be sum(case...
It will calculate the total cost of the element per order and then average cost for the element based on last 5 orders,...
January 9, 2009 at 8:18 am
Please replace "SUM(CASE...." with "AVG(CASE...."
That should work.
January 8, 2009 at 1:45 pm
Viewing 15 posts - 1 through 15 (of 24 total)