Initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
-- Check quote QT-2602-0050 and its customer
|
||||
DECLARE @QuoteNumber NVARCHAR(50) = 'QT-2602-0050';
|
||||
|
||||
-- Find the quote and customer info
|
||||
SELECT
|
||||
q.Id AS QuoteId,
|
||||
q.QuoteNumber,
|
||||
q.CustomerId,
|
||||
CASE WHEN q.CustomerId IS NULL THEN 1 ELSE 0 END AS IsProspect,
|
||||
q.ProspectCompanyName,
|
||||
q.ProspectContactName,
|
||||
q.IsDeleted AS QuoteIsDeleted,
|
||||
c.Id AS CustomerIdFromTable,
|
||||
c.CompanyName AS CustomerCompanyName,
|
||||
c.IsDeleted AS CustomerIsDeleted
|
||||
FROM Quotes q
|
||||
LEFT JOIN Customers c ON q.CustomerId = c.Id
|
||||
WHERE q.QuoteNumber = @QuoteNumber;
|
||||
|
||||
-- Show all prospect and customer fields
|
||||
SELECT
|
||||
QuoteNumber,
|
||||
CustomerId,
|
||||
CASE WHEN CustomerId IS NULL THEN 'YES' ELSE 'NO' END AS IsProspect,
|
||||
ProspectCompanyName,
|
||||
ProspectContactName,
|
||||
ProspectEmail,
|
||||
ProspectPhone
|
||||
FROM Quotes
|
||||
WHERE QuoteNumber = @QuoteNumber;
|
||||
Reference in New Issue
Block a user