use WSS_Content
-- select from the sharepoint server
select a.nvarchar10 as [PO Number], a.nvarchar11 as [Vendor Name],
convert(decimal(18, 2), a.float1) as [Amount] from AllUserData as a
inner join (SELECT tp_id, max(tp_Modified) AS max_date
FROM AllUserData where tp_dirName = 'demsite/Test Documents'
GROUP BY tp_id) as b
on b.tp_id = a.tp_id
where a.tp_dirName = 'demsite/Test Documents' and b.max_date = a.tp_Modified
order by a.tp_LeafName
--erp server. the erp server can older POs in it and there
--can be more than the SharePpoint Serve, but the PO number
--will always be unique so they will match on each server
select po_id, Vendor_Name, revised_po_amt
from [ERPSRV].[ESIDB].[dbo].[POFOM]
where po_id = 'F27536' or po_id = 'F27536G' or po_id = 'F64499' or po_id = 'F27689' or po_id = 'F27699'
or po_id = 'F27747' or po_id = 'F27751' or po_id = 'F27801' or po_id = 'F27784' or po_id = 'F27698'
|