A总表
B,C子表
关联字段为D_NO
我现在要实现在,当B表里有数据时,显示B表的第一条记录,如果B表没数据时就显示C表的第一条记录
请问有什么好方法实现没有?
谢谢
------解决方案--------------------
- SQL code
if exists(select * from B)beginselect top 1 * from Bendelsebeginselect top 1 * from Cend
if exists(select * from B)beginselect top 1 * from Bendelsebeginselect top 1 * from Cend