Get every row of duplicates within a table - sql

I have code that grabs the duplicates in a SQL table and groups them by tracking number. I want to see EVERY row that duplicates, not just have them group. The code for getting the group of duplicates is below:
Select
CarrierID
, Mode
, TrackingNumber
, PickupID
, Reference1
, Reference2
, Quantity
, BilledWeight
, ActualWeight
, Zone
, ServiceLevel
, PickupDate
, SenderCompany
, SenderAddress
, SenderCity
, SenderState
, SenderZip
, ReceiverCompany
, ReceiverAddress
, ReceiverCity
, ReceiverState
, ReceiverZip
, FreightCharge
, Fuel
, Accessories
, TotalCharges
, WrongName
, WrongCompany
, WrongAddress
, WrongCity
, WrongState
, WrongZip
, WrongCountry
, CorrectedName
, CorrectedCompany
, CorrectedAddress
, CorrectedCity
, CorrectedState
, CorrectedZip
, CorrectedCountry
, Count(TrackingNumber) as TrackingNumberTotal
, Count(TotalCharges) as NumberofDuplicates
from Prasco_GencoShipments
group by
TrackingNumber
, TotalCharges
, CarrierID
, Mode
, TrackingNumber
, PickupID
, Reference1
, Reference2
, Quantity
, BilledWeight
, ActualWeight
, Zone
, ServiceLevel
, PickupDate
, SenderCompany
, SenderAddress
, SenderCity
, SenderState
, SenderZip
, ReceiverCompany
, ReceiverAddress
, ReceiverCity
, ReceiverState
, ReceiverZip
, FreightCharge
, Fuel
, Accessories
, TotalCharges
, WrongName
, WrongCompany
, WrongAddress
, WrongCity
, WrongState
, WrongZip
, WrongCountry
, CorrectedName
, CorrectedCompany
, CorrectedAddress
, CorrectedCity
, CorrectedState
, CorrectedZip
, CorrectedCountry
having (count(TrackingNumber) > 1 and (count(TotalCharges) > 1))

If CTEs are available (could also be done with a subselect):
WITH dups AS (
SELECT TrackingNumber, TotalCharges
FROM Prasco_GencoShipments
GROUP BY TrackingNumber, TotalCharges
HAVING COUNT(*) > 1
)
SELECT ta.*
FROM Prasco_GencoShipments ta
JOIN dups du ON du.TrackingNumber = ta.TrackingNumber AND du.TotalCharges = ta.TotalCharges
ORDER BY
TrackingNumber
, TotalCharges
;

Find duplicates for field1 ( and field2 , commented):
SELECT t1.*
FROM test t1
INNER JOIN test t2
ON t2.field1 = t1.field1 -- AND t2.field2 = t1.field2
WHERE t1.id <> t2.id
SQLFiddle

Related

SQL Pivot Issue

If you could please help with this. The code generates an error:
Msg 8156, Level 16, State 1, Line 236
The column 'Classification_Value_Id' was specified multiple times for 'piv1'.
I am doing this on SQL Server. The steps for the code is as follows:
1. Unpivot the data from the source table DB.[dbo].[Classification] into one column
2. Join this unpivoted data to a table called DB.dbo.[Classification_Value] to return/add the column 'cv.Classification_Name' to the data set
3. Pivot this dataset (This is the part returning the error)
CODE:
SELECT
activityCode
, actjvPartnerRef
, actMonth
, actSalesChannel
, addCBPCharge
, agentId
, appType
, areaCode
--SELECT
--polRef,[Arrangement_Id],UnpivotedData.Classification_Value_Id,UnpivotedData.Classification_Scheme_Id,ColValues, ColNames,cv.Classification_Name
FROM
(
SELECT top 10
[polRef]
, [Arrangement_Id]
, [Classification_Scheme_Id]
, [Classification_Value_Id]
-- ,[Arrangement_Classification_Type_Id]
-- ,[Effective_TimeStamp]
-- ,[End_date]
, CAST((ISNULL([character_measure],'')) AS NVARCHAR(MAX)) AS character_measure
, CAST((ISNULL([datetime_measure],'')) AS NVARCHAR(MAX)) AS datetime_measure
, CAST([decimal_measure] AS NVARCHAR(MAX)) AS decimal_measure
, CAST((ISNULL([integer_measure],'')) AS NVARCHAR(MAX)) AS integer_measure
, CAST((ISNULL([logical_measure],'')) AS NVARCHAR(MAX)) AS logical_measure
, CAST((ISNULL([charmax_measure],'')) AS NVARCHAR(MAX)) AS charmax_measure
, CAST((ISNULL([long_measure],'')) AS NVARCHAR(MAX)) AS long_measure
FROM DB.[dbo].[Classification]
) AS SrcDataConverted
UNPIVOT
(
ColValues FOR ColNames IN
(
character_measure
, datetime_measure
, decimal_measure
, integer_measure
, logical_measure
, charmax_measure
, long_measure
)
) AS UnpivotedData
LEFT JOIN DB.dbo.[Classification_Value] cv
ON cv.[Classification_Scheme_Id] = UnpivotedData.[Classification_Scheme_Id]
AND cv.Classification_Value_Id = UnpivotedData.Classification_Value_Id
PIVOT
(MAX(ColValues) for Classification_Name in (
activityCode
, actjvPartnerRef
, actMonth
, actSalesChannel
, addCBPCharge
, agentId
, appType
, areaCode
)) AS piv1;
Any help would be much appreciated
Thank you
StuarLC:
An additional derived table needs to wrap the results of the UNPIVOT before commencing the re-PIVOT, as the join introduces a duplicated Classification_Value_Id and Classification_Scheme_id, which is needed for the join.
select
activityCode
, actjvPartnerRef
, actMonth
, actSalesChannel
, addCBPCharge
, agentId
, appType
, areaCode
from (
SELECT polRef
, [Arrangement_Id]
, UnpivotedData.Classification_Value_Id
, UnpivotedData.Classification_Scheme_Id
, ColValues
, ColNames
, Classification_Name
FROM (
SELECT [polRef]
, [Arrangement_Id]
, [Classification_Scheme_Id]
, [Classification_Value_Id]
, CAST((ISNULL([character_measure],'')) AS NVARCHAR(MAX)) AS character_measure
, CAST((ISNULL([datetime_measure],'')) AS NVARCHAR(MAX)) AS datetime_measure
, CAST([decimal_measure] AS NVARCHAR(MAX)) AS decimal_measure
, CAST((ISNULL([integer_measure],'')) AS NVARCHAR(MAX)) AS integer_measure
, CAST((ISNULL([logical_measure],'')) AS NVARCHAR(MAX)) AS logical_measure
, CAST((ISNULL([charmax_measure],'')) AS NVARCHAR(MAX)) AS charmax_measure
, CAST((ISNULL([long_measure],'')) AS NVARCHAR(MAX)) AS long_measure
FROM DB.[dbo].[Classification]
) AS SrcDataConverted
UNPIVOT
(
ColValues FOR ColNames IN
(
character_measure
, datetime_measure
, decimal_measure
, integer_measure
, logical_measure
, charmax_measure
, long_measure
)
) AS UnpivotedData
LEFT JOIN
DB.dbo.[Classification_Value] cv
ON cv.[Classification_Scheme_Id] = UnpivotedData.[Classification_Scheme_Id]
AND cv.Classification_Value_Id = UnpivotedData.Classification_Value_Id
) as src
PIVOT
(
MAX(ColValues) for Classification_Name in (
activityCode
, actjvPartnerRef
, actMonth
, actSalesChannel
, addCBPCharge
, agentId
, appType
, areaCode
)
) AS piv1;

could not create a list of fields for the query [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am clicking on REFRESH FIELDS for my query for a shared dataset, and getting this error:
here's my query:
Select
p.AgeCodePL ,
p.BirthDate ,
p.CommunityIDY ,
p.Company ,
p.CreatedbyUser ,
p.DateCreated ,
p.DateExpired ,
p.DateUpdated ,
p.Department ,
p.EthnicityFK ,
p.FirstName firstFirstName,
p.GenderUL ,
p.LastName ,
p.MaritalStatusUL ,
p.MiddleName ,
p.NickName ,
p.PeopleIDY ,
p.PrefixUL ,
p.RaceUL ,
p.ReligionUL ,
p.Salutation ,
p.SpouseName ,
p.SSN ,
p.SuffixUL ,
p.Title ,
p.UpdatedbyUser ,
r.ACT_ID ,
r.HEA_ID ,
r.INT_ID ,
r.LIF_ID ,
r.NetworkSet ,
r.PER_ID ,
r.RES_Active ,
r.RES_Bio ,
r.RES_BioUpdate ,
r.RES_BioUpdateBy ,
r.RES_CommunityIDY ,
r.RES_CurrentUnitNumber ,
r.RES_DateStarted ,
r.RES_DiscNotes1 ,
r.RES_DiscNotes2 ,
r.RES_DiscNotes3 ,
r.RES_DiscNotes4 ,
r.RES_DiscNotes5 ,
r.RES_ExpiredDate ,
r.RES_ExpiredUser ,
r.RES_FinishedDate ,
r.RES_HasImage ,
r.RES_LastUserUpdated ,
r.RES_LobbyBio ,
r.RES_LobbyBioUpdate ,
r.RES_LobbyBioUpdateBy ,
r.RES_NoPart ,
r.RES_PeopleIDY ,
r.RES_PhyMoveInDate ,
r.RES_TasksSet ,
r.RES_UpdatedImage ,
r.STA_ID ,
r.STA_Type ,
r.TES_ID ,
rr.CommunityIDY ,
rr.CurrentUnitNumber ,
rr.Gender ,
rr.MainBirthDate ,
rr.MainFirstName ,
rr.MainLastName ,
rr.MainPeopleIDY ,
rr.Name ,
rr.ProspectIDY ,
s.RES_ID ,
s.STA_Active ,
s.STA_CreatedOn ,
s.STA_DateUpdated ,
s.STA_Details ,
s.STA_EditedDate ,
s.STA_EditedUser ,
s.STA_ID ,
s.STA_Reason ,
s.STA_Solution ,
s.STA_Type ,
s.STA_User ,
u.PRO_ID ,
u.STU_ID ,
u.TEA_ID ,
u.USR_AboutMe ,
u.USR_Active ,
u.USR_AllComm ,
u.USR_Bday ,
u.USR_BdayDay ,
u.USR_CellPhone ,
u.USR_CommLocation ,
u.USR_CommunityIDY ,
u.USR_ContactFor ,
u.USR_DirectPhone ,
u.USR_Email ,
u.USR_EntAdmin ,
u.USR_FavBooks ,
u.USR_FavMovies ,
u.USR_FavPart ,
u.USR_FavQuotes ,
u.USR_Fax ,
u.USR_First ,
u.USR_Goals ,
u.USR_HasImage ,
u.USR_HomeTown ,
u.USR_ID ,
u.USR_Interests ,
u.USR_INTL_Password ,
u.USR_INTL_UserName ,
u.USR_IsSales ,
u.USR_JoinedKisco ,
u.USR_Last ,
u.USR_LastLogin ,
u.USR_LastProUpdate ,
u.USR_Name ,
u.USR_OtherTeams ,
u.USR_Password ,
u.USR_PlacesBeen ,
u.USR_REPS_Password ,
u.USR_REPS_UserIDY ,
u.USR_REPS_UserName ,
u.USR_Role ,
u.USR_RoleDescrip
from
Status s
Inner Join Residents r
ON r.RES_ID = s.RES_ID
Left Join REPSResidents rr
ON rr.MainPeopleIDY = r.RES_PeopleIDY
Inner Join Associate u
ON s.STA_User = u.USR_ID
Inner Join KSLSQL1.[RPS-201065-000].dbo.people p
ON r.RES_PeopleIDY = p.PeopleIDY
Where
rr.CommunityIDY in (#Community)
and (s.STA_Reason is not null and s.STA_Reason <> '')
and s.STA_Active = 1
and s.STA_DateUpdated between #BegDate and dateadd(d,1,#EndDate)
Order by
s.STA_DateUpdated DESC
what am i doing wrong?
The issue is because you have two columns with the exact same name in your query:
r.RES_ID ,
s.RES_ID ,
The columns must have different names. Either give them an alias to make them distinct or remove one of them, since they will have identical values based on your join.

SQL divide by zero error encountered

I'm having an issue debugging my SQL code to find out why I'm producing a "divide by zero error encountered". I believe that this error occurs when trying to divide by a null value and using NULLIF as I understand is a way to prevent this. I have been unsuccessful in my attempts and could use some extra eyes on my code. SQL Server database
SET NOCOUNT ON;
SELECT CAST(yr AS INT) AS yr ,
CAST(rs.RTRIM(D.bus_name) AS VARCHAR(100)) AS bus_name ,
CAST(rs.RTRIM(D.bus_code) AS VARCHAR(20)) AS bus_code ,
SUM(CAST(D.salary AS NUMERIC(18, 2))) AS bus_salary ,
SUM(D.total_assign) AS total_assignment
FROM (
--begin: table:D
SELECT C.bus_code ,
C.bus_name ,
C.sales_issue_id ,
SUM(CAST(C.salary AS NUMERIC(18, 2))) AS salary ,
MAX(total_fte) AS total_fte ,
SUM(C.assigned_fte) AS total_assign ,
MAX(total_salary) AS total_salary ,
C.yr
FROM (
--begin: table C:
SELECT B.sales_issue_id ,
B.last_name ,
B.firs.t_name ,
B.bus_code ,
B.bus_name ,
B.total_salary ,
B.assigned_fte ,
( B.total_salary * B.assigned_fte )
/ total_fte AS salary ,
B.total_fte ,
B.yr
FROM --table B:
(
--begin B:
SELECT tb_total_fte_salary.sales_issue_id ,
rs.bus_name ,
tb_total_fte_salary.total_fte ,
rs.region_code
+ rs.county_code
+ rs.bus_code AS bus_code ,
rs.last_name ,
rs.first_name ,
tb_total_fte_salary.total_salary ,
assigned_fte = CASE rs.assign_fte
WHEN '' THEN 0
ELSE CAST(rs.assign_fte AS NUMERIC(18,
2))
END ,
rs.yr
FROM dbo.raw_sales AS rs,
(
SELECT sales_issue_id ,
yr ,
MAX(last_name) AS last_name ,
MAX(first_name) AS first_name ,
SUM(CAST(assign_fte AS NUMERIC(18,
2))) AS total_fte ,
MAX(CAST(NULLIF(total_salary,
0) AS NUMERIC(18,
2))) AS total_salary
FROM raw_sales
GROUP BY sales_issue_id ,
yr
--end
) tb_total_fte_salary
WHERE rs.sales_issue_id = tb_total_fte_salary.sales_issue_id
AND rs.yr = tb_total_fte_salary.yr
--end B:
) B
--end C:
) C
GROUP BY C.sales_issue_id ,
C.last_name ,
first_name ,
C.bus_name ,
C.bus_code ,
C.yr
--end D:
) D
GROUP BY bus_code ,
bus_name ,
yr
ORDER BY yr ,
bus_code ,
bus_name
try :
SET NOCOUNT ON;
SELECT CAST(yr AS INT) AS yr ,
CAST(rs.RTRIM(D.bus_name) AS VARCHAR(100)) AS bus_name ,
CAST(rs.RTRIM(D.bus_code) AS VARCHAR(20)) AS bus_code ,
SUM(CAST(D.salary AS NUMERIC(18, 2))) AS bus_salary ,
SUM(D.total_assign) AS total_assignment
FROM (
--begin: table:D
SELECT C.bus_code ,
C.bus_name ,
C.sales_issue_id ,
SUM(CAST(C.salary AS NUMERIC(18, 2))) AS salary ,
MAX(total_fte) AS total_fte ,
SUM(C.assigned_fte) AS total_assign ,
MAX(total_salary) AS total_salary ,
C.yr
FROM (
--begin: table C:
SELECT B.sales_issue_id ,
B.last_name ,
B.firs.t_name ,
B.bus_code ,
B.bus_name ,
B.total_salary ,
B.assigned_fte ,
-- this is where i changed your query
case when total_fte > 0 then
( B.total_salary * B.assigned_fte )
/ total_fte
else 0 end
AS salary ,
B.total_fte ,
B.yr
FROM --table B:
(
--begin B:
SELECT tb_total_fte_salary.sales_issue_id ,
rs.bus_name ,
tb_total_fte_salary.total_fte ,
rs.region_code
+ rs.county_code
+ rs.bus_code AS bus_code ,
rs.last_name ,
rs.first_name ,
tb_total_fte_salary.total_salary ,
assigned_fte = CASE rs.assign_fte
WHEN '' THEN 0
ELSE CAST(rs.assign_fte AS NUMERIC(18,
2))
END ,
rs.yr
FROM dbo.raw_sales AS rs,
(
SELECT sales_issue_id ,
yr ,
MAX(last_name) AS last_name ,
MAX(first_name) AS first_name ,
SUM(CAST(assign_fte AS NUMERIC(18,
2))) AS total_fte ,
MAX(CAST(NULLIF(total_salary,
0) AS NUMERIC(18,
2))) AS total_salary
FROM raw_sales
GROUP BY sales_issue_id ,
yr
--end
) tb_total_fte_salary
WHERE rs.sales_issue_id = tb_total_fte_salary.sales_issue_id
AND rs.yr = tb_total_fte_salary.yr
--end B:
) B
--end C:
) C
GROUP BY C.sales_issue_id ,
C.last_name ,
first_name ,
C.bus_name ,
C.bus_code ,
C.yr
--end D:
) D
GROUP BY bus_code ,
bus_name ,
yr
ORDER BY yr ,
bus_code ,
bus_name

Incorrect syntax near ')' on the last parenthesis when changing from openquery to a subquery on a local database

Why does this query return "Incorrect syntax near ')' " on the last parenthesis when changing from openquery to a subquery on a local database?
You can see the commented lines where the openquery started before (and worked)
select right(rtrim(a.vouchernumber),9) as voucherkey
, a.vouchernumber
, vendorkey
, rtrim(invoicenumber) as invoicenumber
, invoicedate
, duedate
, documenttype
, PostDate
, qty
, amt =
CASE
WHEN documenttype = 'D' THEN -(amt)
WHEN b.transactiontype = 'V' THEN -(amt)
ELSE
amt
End
, extendedlineamt
, intercompanyid
, acct
, NaturalAcct
, c.segmentdescription as NaturalAcctDesc
, Dept
, f.segmentdescription as DeptDesc
, Site
, d.segmentdescription as SiteDesc
, Project
, e.segmentdescription as ProjDesc
, b.*
, rtrim(vendorname) as vendorname
, rtrim(vendoraddress1) as vendoraddress1
, vendoraddress2
, vendoraddress3
, vendorcity
, rtrim(vendorstate) as vendorstate
, rtrim(vendorzipcode) as vendorzipcode
, rtrim(vendoraddress1) + ' ' + rtrim(vendoraddress2) +' ' + rtrim(vendorcity) + ', ' + rtrim(vendorstate) as VendorAddress
, Dept + '.' + Site + '.' + Project as ProjectId
--from openquery (LinkedServer,
-- 'select a.vouchernumber
from (
select a.vouchernumber
, a.vendorkey
, a.invoicenumber
, a.invoicedate
, a.duedate
, a.documenttype
, a.recdate as PostDate
, b.qty
, b.amt
, b.extendedlineamt
, b.intercompanyid
, b.acct
, Substring(Acct, 1, 4) as NaturalAcct
, Substring(Acct,8, 3 ) as Site
, Substring(Acct,11, 4 ) as Project
, Substring(Acct,5,3) as Dept
, v.vendorname
, v.vendoraddress1
, v.vendoraddress2
, v.vendoraddress3
, v.vendorcity
, v.vendorstate
, v.vendorzipcode
from aphdr a
join aplin b
on a.vouchernumber = b.vouchernumber
left join apvend v
on a.vendorkey = v.vendorkey
where a.recdate between '2011-01-01' and '2012-10-02'
and cast(Substring(Acct,11, 4 ) as varchar(4)) like 'VIR'
and left(a.vouchernumber,1) <> 'G'
and Company = 'ASSFD'
)
You need to alias your subquery.
put a alias name at the end of your query.
You need to give the subquery an alias (or name).
here i've just added tbl1 to the very end
select right(rtrim(a.vouchernumber),9) as voucherkey
, a.vouchernumber
, vendorkey
, rtrim(invoicenumber) as invoicenumber
, invoicedate
, duedate
, documenttype
, PostDate
, qty
, amt =
CASE
WHEN documenttype = 'D' THEN -(amt)
WHEN b.transactiontype = 'V' THEN -(amt)
ELSE
amt
End
, extendedlineamt
, intercompanyid
, acct
, NaturalAcct
, c.segmentdescription as NaturalAcctDesc
, Dept
, f.segmentdescription as DeptDesc
, Site
, d.segmentdescription as SiteDesc
, Project
, e.segmentdescription as ProjDesc
, b.*
, rtrim(vendorname) as vendorname
, rtrim(vendoraddress1) as vendoraddress1
, vendoraddress2
, vendoraddress3
, vendorcity
, rtrim(vendorstate) as vendorstate
, rtrim(vendorzipcode) as vendorzipcode
, rtrim(vendoraddress1) + ' ' + rtrim(vendoraddress2) +' ' + rtrim(vendorcity) + ', ' + rtrim(vendorstate) as VendorAddress
, Dept + '.' + Site + '.' + Project as ProjectId
--from openquery (LinkedServer,
-- 'select a.vouchernumber
from (
select a.vouchernumber
, a.vendorkey
, a.invoicenumber
, a.invoicedate
, a.duedate
, a.documenttype
, a.recdate as PostDate
, b.qty
, b.amt
, b.extendedlineamt
, b.intercompanyid
, b.acct
, Substring(Acct, 1, 4) as NaturalAcct
, Substring(Acct,8, 3 ) as Site
, Substring(Acct,11, 4 ) as Project
, Substring(Acct,5,3) as Dept
, v.vendorname
, v.vendoraddress1
, v.vendoraddress2
, v.vendoraddress3
, v.vendorcity
, v.vendorstate
, v.vendorzipcode
from aphdr a
join aplin b
on a.vouchernumber = b.vouchernumber
left join apvend v
on a.vendorkey = v.vendorkey
where a.recdate between '2011-01-01' and '2012-10-02'
and cast(Substring(Acct,11, 4 ) as varchar(4)) like 'VIR'
and left(a.vouchernumber,1) <> 'G'
and Company = 'ASSFD'
) tbl1

Getting MAX Value of a Field for INSERT Statement

I am trying to insert a new record in a small settings table and I would like to get the MAX value of the DisplayOrder field and add 10 to it. I get errors with the MAX function in the value of the insert.
INSERT INTO tMrMenu
([ParentId]
,[DisplayOrder]
,[ItemName]
,[ItemDescription]
,[ItemURL]
,[ItemImage]
,[CreateDate]
,[CreateUser]
,[LastUpdateDate]
,[LastUpdateUser]
,[module]
,[isactive])
SELECT
( 1
, (SELECT MAX(DisplayOrder) + 10 FROM tMrMenu)
, 'EDM Summary Text'
, 'EDM Summary Text'
, '/Offline/Reports/EdmSummaryText'
, 'cli.gif'
, GETDATE()
, 'Garry.Bargsley'
, GETDATE()
, 'Garry.Bargsley'
, 'MR'
, 1)
You have extra parenthesis:
INSERT INTO tMrMenu
([ParentId]
,[DisplayOrder]
,[ItemName]
,[ItemDescription]
,[ItemURL]
,[ItemImage]
,[CreateDate]
,[CreateUser]
,[LastUpdateDate]
,[LastUpdateUser]
,[module]
,[isactive])
SELECT
1
, (SELECT MAX(DisplayOrder) + 10 FROM tMrMenu)
, 'EDM Summary Text'
, 'EDM Summary Text'
, '/Offline/Reports/EdmSummaryText'
, 'cli.gif'
, GETDATE()
, 'Garry.Bargsley'
, GETDATE()
, 'Garry.Bargsley'
, 'MR'
, 1
Declare #max int
SET #max = (SELECT MAX...)
INSERT INTO tMrMenu...
SELECT
...
#max,
...
INSERT INTO tMrMenu
([ParentId]
,[DisplayOrder]
,[ItemName]
,[ItemDescription]
,[ItemURL]
,[ItemImage]
,[CreateDate]
,[CreateUser]
,[LastUpdateDate]
,[LastUpdateUser]
,[module]
,[isactive])
SELECT MAX(DisplayOrder) + 10
, 'EDM Summary Text'
, 'EDM Summary Text'
, '/Offline/Reports/EdmSummaryText'
, 'cli.gif'
, GETDATE()
, 'Garry.Bargsley'
, GETDATE()
, 'Garry.Bargsley'
, 'MR'
, 1
FROM tMrMenu