Viewing 15 posts - 1,126 through 1,140 (of 1,494 total)
Without some sample data it is difficult to tell what you want.
Maybe something like:
SELECT U1.UserNew
    ,D.TelNumber
    ,D.ChangeDate AS DeviceDate
    ,D.IMEInew
FROM DeviceHistory D
    JOIN (
            UserHistory U1
            LEFT JOIN UserHistory U2
                ON U1.TelNumber = U2.TelNumber
                    AND U1.UserNew = U2.UserOld
                    AND...
October 4, 2007 at 5:33 am
You could try something horrible like:
DECLARE @TimeFrom datetime
,@TimeTo datetime;
SELECT @TimeFrom = DATEADD(mi, -1, MAX([TimeStamp]))
,@TimeTo = MAX([TimeStamp])
FROM dbo.DemandSpread;
SELECT
D1.MinER2BidPrice
,D2.MinER2DSTotal
,D1.MaxER2BidPrice
,D3.MaxER2DSTotal
,D1.MinESBidPrice
,D4.MinESDSTotal
,D1.MaxESBidPrice
,D5.MaxESDSTotal
FROM (
SELECT MIN(S1.ER2BidPrice) AS MinER2BidPrice
,MAX(S1.ER2BidPrice) AS MaxER2BidPrice
,MIN(S1.ESBidPrice) AS MinESBidPrice
,MAX(S1.ESBidPrice) AS MaxESBidPrice
FROM dbo.DemandSpread S1
WHERE S1.[TimeStamp]...
September 17, 2007 at 10:07 am
or you could try something like:
SELECT *
FROM YourTable T
JOIN (
SELECT '98101' UNION ALL
SELECT '98104' UNION ALL
SELECT '98154'
) D (ZIP)
ON T.ZIP LIKE D.ZIP + '%'
September 13, 2007 at 10:21 am
- The #temp table creates an unique ID for each row in AcctDetails. (Ordered by TransTypeCode)
- The derived table, D, has the minimum ID for each TransTypeCode. (This is needed...
September 13, 2007 at 10:11 am
1. As David mentioned, I am not sure why you would want to do this.
2. Avoid SELECT INTO in production code as it puts schema locks on tempdb.
3. Avoid loops....
September 12, 2007 at 7:56 am
Umm...
If the selected mappings can be a subset of the mappings in #tmpmappings, then the following may work. If not, I do not see any alternative but to count.
SELECT DISTINCT...
September 11, 2007 at 7:29 am
Maybe:
SELECT D1.ReferenceID
FROM (
SELECT M.ReferenceID, COUNT(M.ReferenceID) AS RefCount
FROM #tmpmappings M
GROUP BY M.ReferenceID
) D1
JOIN (
SELECT M1.ReferenceID, COUNT(M1.ReferenceID) AS RefCount
FROM #tmpmappings M1
JOIN #tmpSelectedMappings S1
ON M1.MappingTypeID = S1.SelectedTypeID
AND M1.MappingID = S1.SelectedID
GROUP BY M1.ReferenceID
) D2
ON...
September 11, 2007 at 6:56 am
Joe,
As John indicated, we do not mean any offence but in order to solve the problem we need a 'test bed'.
Your CREATE TABLE...
September 6, 2007 at 10:48 am
Maybe you should post some correct DDL, some sensible sample data, the results you get and the results you want.
(If you do this you may even be able to work...
September 6, 2007 at 8:44 am
Maybe:
SELECT
T.ittnumber
,COALESCE(T.itttitle, T.ittdescription) AS itttitle
,T.daterequired
FROM dbo.tbl3215 T
WHERE T.completed = 0
AND COALESCE(T.itttitle, T.ittdescription) IS NOT NULL
AND EXISTS (
SELECT *
FROM dbo.tblassignment A
WHERE A.ittnumber = T.ittnumber
AND EXISTS (
SELECT *
FROM dbo.tblfltwrkcntr W
WHERE W.fltwkcntrid = A.assfltwrkid
AND...
September 6, 2007 at 5:58 am
As t.PAY_CODE_NUM seems to be an int, it may be worth replacing t.PAY_CODE_NUM IN ('600', '17') with t.PAY_CODE_NUM IN (600, 17) in order
to stop the implicit conversion. (Might help...
September 5, 2007 at 11:35 am
You may want to consider shortening your nvarchar(max) columns.
The following may work:
SELECT
T.ittnumber
,COALESCE(T.itttitle, T.ittdescription) AS itttitle
,T.daterequired
FROM dbo.tbl3215 T
WHERE T.completed = 0
AND COALESCE(T.itttitle, T.ittdescription) IS NOT NULL
AND EXISTS (
SELECT *
FROM dbo.tblassignment A
WHERE...
September 5, 2007 at 10:05 am
You need to alias the derived table.
September 3, 2007 at 7:38 am
On looking at this again, James has a good point about an unique constraint on AA_Anno and Val_NumSpedizione. If you want to add this constraint then try an instead of trigger...
August 29, 2007 at 11:07 am
>>>And if the trigger goes in error (for some reason...), the transaction is rollbacked??
Maybe.
You need to be careful with transactions. If SET XACT_ABORT is off, as it normally is, then the statement is...
August 29, 2007 at 9:43 am
Viewing 15 posts - 1,126 through 1,140 (of 1,494 total)