问题一:我有一个数据库,里面有几个表,分别是A表aid atitle ashowB表bid aid btitle C表cid aid bid ctitle ctime
我现在想以C表为主,读出一些数据select top 10 * from a,b,c where c.aid=a.aid and c.bid=b.bid order by c.cid desc我上面是一个基本的SQL语句,我现在想实现的是,读出的前10条数据中,C表中相同aid的数据只显示一条,并且,这条是离当日时间最近的一条,请问该怎么做呢?问题二我的问题一中A表中数据是通过repeater读出来的,然后在.aspx页面中
<asp:Repeater id="neirong" runat="server">
<ItemTemplate>
<tr><td><%# DataBinder.Eval(Container.DataItem, "atitle") %></td></tr>
</ItemTemplate>
</asp:Repeater>
我想在里面加入条件,比如,ashow=1 的时候,我才显示出atitle,请问这个该怎么写呢?
我现在想以C表为主,读出一些数据select top 10 * from a,b,c where c.aid=a.aid and c.bid=b.bid order by c.cid desc我上面是一个基本的SQL语句,我现在想实现的是,读出的前10条数据中,C表中相同aid的数据只显示一条,并且,这条是离当日时间最近的一条,请问该怎么做呢?问题二我的问题一中A表中数据是通过repeater读出来的,然后在.aspx页面中
<asp:Repeater id="neirong" runat="server">
<ItemTemplate>
<tr><td><%# DataBinder.Eval(Container.DataItem, "atitle") %></td></tr>
</ItemTemplate>
</asp:Repeater>
我想在里面加入条件,比如,ashow=1 的时候,我才显示出atitle,请问这个该怎么写呢?
{
if(atitle=="条件显示")
return "你需要显示的";
else
return "需要显示的";
]
else不显示不就是一条了啊....