开发者

condition based on availability of data

开发者 https://www.devze.com 2023-02-03 07:10 出处:网络
I have a table with (EX)ij values for different countries, i,and different sectors,j. So the table includes three fields; country, sector and Export value. Two other tables include Qij and Aij values

I have a table with (EX)ij values for different countries, i,and different sectors,j. So the table includes three fields; country, sector and Export value. Two other tables include Qij and Aij values with the same structure. I want to write a query saying that For each (EX)ij, if Qij is available, create a table with EXij-Qij values, if Qij is NOT available, and Aij is available (Aij may be unavailable) instead of EXij-Qij write EXij-Aij. And if both Qij and Aij are unavailable return null. Very complicated for me开发者_如何学C!


You have three tables with the same structure; you need to combine the three tables into one table. Once you have done this it will be much easier to query.

Before you attempt to combine the tables, you will need to add a new field to each table and populate the new field with an integer to identify the table that particular record is from.

0

精彩评论

暂无评论...
验证码 换一张
取 消