Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SELECT f.id
, f.file_title_id
, f.url
, f.version_number
FROM tblFiles f
INNER
JOIN (
SELECT file_title_id
, max(version_number) as max_version
FROM tblFiles
GROUP
BY file_title_id
) as m
ON m.file_title_id = f.file_title_id
AND m.max_version = f.version_number
SELECT f.id
, f.file_title_id
, f.url
, f.version_number
FROM tblFiles f
WHERE f.version_number =
( SELECT max(version_number)
FROM tblFiles
WHERE file_title_id = f.file_title_id )
SELECT CustomerID
FROM Customers a
WHERE EXISTS (
SELECT *
FROM Orders
WHERE Fulfilled = 0
AND CustomerID = a.CustomerID
)
SELECT a.CustomerID
FROM Customers a
JOIN Orders o ON o.CustomerID = a.CustomerID
AND Fulfilled = 0
SELECT DISTINCT a.CustomerID
FROM Customers a
JOIN Orders o ON o.CustomerID = a.CustomerID
AND Fulfilled = 0
SELECT a.CustomerID,
a.orderID AS LatestOrderID,
a.orderdate AS LatestOrderDate,
b.orderID AS PreviousOrderID,
b.orderdate AS PreviousOrderDate
FROM Orders a
JOIN Orders b ON b.CustomerID = a.CustomerID
AND b.orderdate = (
SELECT MAX(orderdate)
FROM Orders
WHERE CustomerID = a.CustomerID
AND orderdate < a.orderdate
)
SELECT a.CustomerID,
a.orderID AS LatestOrderID,
a.orderdate AS LatestOrderDate,
b.orderID AS PreviousOrderID,
b.orderdate AS PreviousOrderDate
FROM (
SELECT CustomerID,
MAX(orderID) AS orderID,
MAX(orderdate) AS orderdate
FROM Orders
GROUP BY CustomerID
) a
JOIN Orders b ON b.CustomerID = a.CustomerID
AND b.orderdate < a.orderdate
SELECT a.CustomerID,
a.orderID AS LatestOrderID,
a.orderdate AS LatestOrderDate,
a.salespersonID AS LastestSalesPersonID,
b.orderID AS PreviousOrderID,
b.orderdate AS PreviousOrderDate
FROM Orders a
JOIN Orders b ON b.CustomerID = a.CustomerID
AND b.orderdate = (
SELECT MAX(orderdate)
FROM Orders
WHERE CustomerID = a.CustomerID
AND orderdate < a.orderdate
)