熟悉access创建视图
Access中创建试图语句:
SELECT TableA.F1, TableA.F2, TableA.F3+TableB.F3 AS F3, TableA.F4 & TableB.F4 AS F4
FROM TableA INNER JOIN TableB ON (TableA.F2 = TableB.F2) AND (TableA.F1 = TableB.F1);
这个语句可以创建,目前我想如何使创建的视图字段F4(也就是TableA中和TableB中F4字段相连结果)
在一般的情况下是TableA和TableB字段相连,但是如果TableA中的字段值为"FF",那么视图字段F4值就为一个固定值"XX"
------解决方案--------------------
SELECT TableA.F1, TableA.F2, TableA.F3+TableB.F3 AS F3,
IIF(TableA.F4='FF', 'XX' ,TableA.F4 & TableB.F4) AS F4
FROM TableA INNER JOIN TableB ON (TableA.F2 = TableB.F2) AND (TableA.F1 = TableB.F1);
------解决方案--------------------
SELECT TableA.F1, TableA.F2, TableA.F3+TableB.F3 AS F3,
IIF(TableA.F4='FF', 'XX' ,TableA.F4 & TableB.F4) AS F4
FROM TableA INNER JOIN TableB ON (TableA.F2 = TableB.F2) AND (TableA.F1 = TableB.F1);
用IIF即可