我有两个表,分别是card_info和card_sale,card_sale是一个卡的销售表,里面有两个字段start_no,end_no分别记录销售的起始和终止号段。card_info是卡的信息表,里面有一个字段card_no记录卡号,这个卡号在card_sale表的start_no,end_no号段中,我现在的问题是,我想查出满足我条件的号段中所有的card_no,这个sql语句怎么组织?
满足我条件的号段sql我是这么写的,select start_no,end_no from card_sale where 条件;
我现在的问题是select card_no from card_info where card_info 在上述号段中,这里的sql不知道怎么组织,请高人指点。
满足我条件的号段sql我是这么写的,select start_no,end_no from card_sale where 条件;
我现在的问题是select card_no from card_info where card_info 在上述号段中,这里的sql不知道怎么组织,请高人指点。
我现在的问题是select card_no from card_info where card_no 在上述号段中,这里的sql不知道怎么组织,请高人指点。
where card_no between a.start_no and a.end_no
from card_info c
where exists (select 1
from care_sale
where 条件
and c.card_no between start_no and end_no)