If anyone could help me join these two selects together to create one mega statement that would be awesome!!
–running against quotingSystem database
SELECT
CONVERT (varchar, Quote.QuoteID) AS QuoteID, Quote.FirstName,
Quote.LastName, Quote.ProductSKU, Quote.ProductID, Quote.Quantity,
Quote.CreationDate,
CONVERT (CHAR(8), Quote.CreationTime, 8) AS CreationTime,
Quote.CompanyName,
IncommingQuoteStatus.StatusDesc, Quote.LockedDateTime,
Users.FirstName + ' ' + Users.LastName AS UserName
FROM
Quote
INNER JOIN
IncommingQuoteStatus ON IncommingQuoteStatus.StatusID = Quote.Status
INNER JOIN
Users ON Quote.LockedUserID = Users.UserID
WHERE
(Quote.Status > 2 AND Quote.Status < 6)
ORDER BY
QuoteID DESC
— running on quoting system database but also pulling in values from another database CBretailDB
select
D2.stock AS CurrentStock
from
dbo.Quote as D1
inner join
CBretailDB.dbo.products AS D2 ON D1.ProductID = D2.idProduct
the Quote.ProductID on the first statement needs to join on the D2.idProduct from second statement to pull the CurrentStock value
I think that makes sense!
Many thanks
Try this: