0

I'll try and explain this as basically as possible. We have a long list-like table with dates in the first column for each working day then a list on individual piercings we have completed with their respective prices and then daily totals in this format:

Date      Piercing  Price   Daily Total
26/10/13  ear       £9.50
          navel     £30     £39.50
28/10/13  nose      £17.50  £17.50
29/10/13  ear       £9.50
          nipple    £25
          eyebrow   £25     £59.50

etc etc

As you can see the column which holds the daily totals will have a lot of blank cells in between. So what we have done is made a separate sheet with a list of dates and are hoping to find some form of lookup function which can read the existing "Daily total" column and copy only the cells which have values over in order that they appear so they match up with the right dates like this:

26/10/13  £39.50
28/10/13  £17.50
29/10/13  £59.50

etc etc

If anyone can lend me as easy way of achieving this I will be most grateful as neither of us are talented with writing our own functions or statement codes.

4

1 回答 1

0

如果您只是在寻找日期和每日总计的列表,假设已经计算了每日总计并且您从未有过负交易,那么这应该可以

SELECT date, MAX(DailyTotal) FROM peircings GROUP BY date;

或者

SELECT date, DailyTotal FROM peircings WHERE DailyTotal!='';

如果没有更好地了解您的数据库以及您希望如何使用数据,很难知道哪一个甚至可以帮助您。

于 2013-10-26T13:14:17.623 回答