问题描述
对于matrimony - 如何检索示例男性用户登录时间在该男性用户页面中显示匹配的个人资料我要求基于演员表,宗教信仰,年龄,身高的数据检索但是我不知道如何获得低于年龄的男性和sql查询中的女性匹配请给我帮助
选择matrimony_Personaldetails.Reg_id,身高,区,dbo.getage(DateofBirth,GETDATE())作为年龄,宗教,种姓,照片来自dbo.matrimony_Personaldetails内部联接dbo.matrimony_register on matrimony_register.Reg_id = matrimony_Personaldetails.Reg_id其中Caste = @caste和Religion = @ religion ...........
For matrimony - how to retrieve example a male user loging time display matched profiles in that male user page i am asking data retrieve based on cast,religilon,age ,Height but i don't no how to get male for below age and height female match in sql query pls i need help
select matrimony_Personaldetails.Reg_id,Height,District,dbo.getage(DateofBirth,GETDATE()) as age,Religion,Caste,Photo from dbo.matrimony_Personaldetails inner join dbo.matrimony_register on matrimony_register.Reg_id=matrimony_Personaldetails.Reg_id where Caste=@caste and Religion=@religion ...........
推荐答案
if @gender='male'
begin
set @gender='female'
begin
select top 8 p.Reg_id,dbo.getage(DateofBirth,GETDATE()) as age,r.Height,p.Religion,p.Caste,r.District from dbo.matrimony_Personaldetails as p left outer join dbo.matrimony_register as r on r.Reg_id=p.Reg_id where Religion=@religion and Gender=@gender and Height<=@Height and DateofBirth>=@dob
end
else
begin
set @gender='male'
if @caste='any'
begin
select top 8 p.Reg_id,dbo.getage(DateofBirth,GETDATE()) as age,r.Height,p.Religion,p.Caste,r.District from dbo.matrimony_Personaldetails as p left outer join dbo.matrimony_register as r on r.Reg_id=p.Reg_id where Religion=@religion and Gender=@gender and Height>=@Height and DateofBirth<=@dob
end
这篇关于怎么做基于女性年龄小于男性年龄的匹配男性形象的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!