How to write a SQL function into Acces 2003

孤街浪徒 提交于 2019-12-12 04:55:25

问题


So I have an acces table : Data

Data is made of :

  • Client ID
  • Product ID
  • Sell Category ( exemple : Sell Dones, Sell Planed ,Forecast Sales) ,written all in letters
  • Quantity sold .
  • unitary price.

I am trying to build a single Acces query which would display things like :

|Client ID||Product ID||Total Sell Dones||Total Sell Planed||Total Forecast Sell||Quantity Sell Dones||Quantity Sell Planed||Quantity Forecast|

How can I do that ?

Like if I had only one type of sell and one single quantity I could simply do :

SELECT (sells*quantity) AS [Total Sells]

But the thing here is have different quantity and different types of sells could I put IF into the select ?

Something like :

Select (IF Data.Sell Category="Planned Sell" THEN quantity Sold*Unitary Price
ELSE 0) as [Total Planned Sell] , etc etc (for every single one ?

The thing is I am using acces 2003 and I dont think I can create a sql function in acces 2003 and use it in my select , but if I can I am willing to do so , else if I can only use "select,delete,update " in acces 2003 I guess I will have to do it like this

来源:https://stackoverflow.com/questions/45371090/how-to-write-a-sql-function-into-acces-2003

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!