M
Michael
I have a table TInvoice: InvoiceId, InvoiveDate, Amount
And a second one TCashierJournal: CashierJournalId, CashierId,
CashierJournalDate, CashierAmount
I wonder if it's possible to resume the both tables in one query, by date.
The situation is the following: on each day, there can be 0 or more invoices
and the same day, and the same day, there are 0 or more cashiers working.
I have already tried with several queries already but couldn't get what I
wanted:
QCashierDaily:
SELECT TCashierJournal.CashierJournalDate, Sum(TCashierJournal.Amount) AS
DailyCashier
FROM TCashierJournal
GROUP BY TCashierJournal.CashierJournalDate
ORDER BY TCashierJournal.CashierJournalDate;
QInvoiceDaily:
SELECT TInvoice.InvoiceDate, Sum(TInvoice.Amount) AS DailyInvoice
FROM TInvoice
GROUP BY TInvoice.InvoiceDate
ORDER BY TInvoice.InvoiceDate;
QWorkday:
SELECT QDailyInvoice.InvoiceDate AS Workday
FROM QDailyInvoice UNION SELECT QDailyCashier.CashierJournalDate FROM
QDailyCashier;
And finally the query I am trying to get working:
QDailyIncome
SELECT QWorkday.Workday, QDailyInvoice.DailyInvoice,
QDailyCashier.DailyCashier
FROM QWorkday, QDailyInvoice, QDailyCashier
WHERE (([InvoiceDate]=[Workday])) AND ([CashierJournalDate]=[Workday]));
The problem I am getting is that I don't get any daily income when there is
no invoice on that day although there is a cashier journal
And a second one TCashierJournal: CashierJournalId, CashierId,
CashierJournalDate, CashierAmount
I wonder if it's possible to resume the both tables in one query, by date.
The situation is the following: on each day, there can be 0 or more invoices
and the same day, and the same day, there are 0 or more cashiers working.
I have already tried with several queries already but couldn't get what I
wanted:
QCashierDaily:
SELECT TCashierJournal.CashierJournalDate, Sum(TCashierJournal.Amount) AS
DailyCashier
FROM TCashierJournal
GROUP BY TCashierJournal.CashierJournalDate
ORDER BY TCashierJournal.CashierJournalDate;
QInvoiceDaily:
SELECT TInvoice.InvoiceDate, Sum(TInvoice.Amount) AS DailyInvoice
FROM TInvoice
GROUP BY TInvoice.InvoiceDate
ORDER BY TInvoice.InvoiceDate;
QWorkday:
SELECT QDailyInvoice.InvoiceDate AS Workday
FROM QDailyInvoice UNION SELECT QDailyCashier.CashierJournalDate FROM
QDailyCashier;
And finally the query I am trying to get working:
QDailyIncome
SELECT QWorkday.Workday, QDailyInvoice.DailyInvoice,
QDailyCashier.DailyCashier
FROM QWorkday, QDailyInvoice, QDailyCashier
WHERE (([InvoiceDate]=[Workday])) AND ([CashierJournalDate]=[Workday]));
The problem I am getting is that I don't get any daily income when there is
no invoice on that day although there is a cashier journal