Viewing 15 posts - 76 through 90 (of 541 total)
Jim Mackenzie (2/23/2015)
Yes you can create a query based on two different servers, here's some info on how to set it up:
https://msdn.microsoft.com/en-GB/library/ff772782.aspx
Your query would end up looking something like...
February 24, 2015 at 4:23 am
GilaMonster (2/16/2015)
Look at Row_Number and the partition by clause, you can then filter on that value to get just the highest....
February 16, 2015 at 6:20 am
GilaMonster (2/16/2015)
Table definitions (as CREATE TABLE statements), sample data (as INSERT statements) and expected results please.
I just want to find a way to group using 2 columns (without the need...
February 16, 2015 at 6:06 am
pwalter83 (2/13/2015)
Lowell (2/10/2015)
you need to use...
February 16, 2015 at 5:43 am
Lowell (2/10/2015)
you need to use row...
February 13, 2015 at 8:10 am
ChrisM@Work (1/30/2015)
CREATE TABLE #tbl_TMIS_DATASET (
[BL_ID] [decimal](10, 0) NOT NULL,
[VESSEL] [nvarchar](10) NULL,
[VOYAGE] [nvarchar](12) NULL,
[LEG] [nchar](3) NULL,
)
INSERT INTO #tbl_TMIS_DATASET
VALUES('19516116','HJAMRC','0010E','E')
CREATE TABLE #MG_BL_ITINERARY(
[BL_ID] [numeric](10, 0) NULL,
[LEG_SEQ_NBR] [numeric](3, 0) NULL,
[VESSEL_CD] [varchar](10) NULL,
[VOYAGE_CD] [varchar](12) NULL,
[LEG_CD]...
January 30, 2015 at 7:34 am
ChrisM@Work (1/29/2015)
pwalter83 (1/29/2015)
For the following query, I am trying to fetch only one row (no duplicates) for each BL_ID based on
the logic that if I have multiple rows for...
January 29, 2015 at 8:26 am
ChrisM@Work (1/29/2015)
pwalter83 (1/29/2015)
For the following query, I am trying to fetch only one row (no duplicates) for each BL_ID based on
the logic that if I have multiple rows for...
January 29, 2015 at 5:49 am
ScottPletcher (12/22/2014)
December 23, 2014 at 4:49 am
LutzM (12/22/2014)
; WITH cte AS
(
SELECT DISTINCT EDI_PARTNER_CD
FROM MG_EDI_PARTNER
UNION ALL
SELECT TOP 1 '(NULL)', EDI_PARTNER_CD
FROM ...
December 23, 2014 at 4:04 am
g.britton (12/19/2014)
ORDER By CASE EDI_PARTNER
WHEN 'INTTRA' THEN 1
WHEN 'GTNEXUS' THEN 2
...
WHEN 'EXPEDITORS' THEN 9
ELSE 10
END
, EDI_PARTNER_CD
Idea is, you have a...
December 22, 2014 at 3:18 am
David Burrows (11/18/2014)
Try this
ORDER BY CASE WHEN COMPANY_ROLE_CD = 'BK' THEN 1 WHEN BOOKED_BY_FLG = 'Y' THEN 2 ELSE 3 END ASC) AS [ROWID]
it worked for me 🙂
Thanks very much,...
November 18, 2014 at 3:06 am
David Burrows (11/17/2014)
the line 'ORDER BY CASE WHEN COMPANY_ROLE_CD = 'BK' THEN 1 ELSE 2 END ASC) AS [ROWID]'
puts the most desirable name at row 1 ie...
November 18, 2014 at 2:21 am
David Burrows (11/14/2014)
LEFT JOIN (
SELECT BOOKING_ID,
CASE WHEN COMPANY_ROLE_CD = 'BK' OR BOOKED_BY_FLG = 'Y'
THEN PARTY_NAME
ELSE NULL
END AS [BOOKING PARTY],
ROW_NUMBER() OVER (
PARTITION BY BOOKING_ID
ORDER BY CASE WHEN COMPANY_ROLE_CD =...
November 17, 2014 at 8:29 am
David Burrows (11/14/2014)
LEFT JOIN (
SELECT BOOKING_ID,
CASE WHEN COMPANY_ROLE_CD = 'BK' OR BOOKED_BY_FLG = 'Y'
THEN PARTY_NAME
ELSE NULL
END AS [BOOKING PARTY],
ROW_NUMBER() OVER (
PARTITION BY BOOKING_ID
ORDER BY CASE WHEN COMPANY_ROLE_CD =...
November 14, 2014 at 9:33 am
Viewing 15 posts - 76 through 90 (of 541 total)