Click here to Skip to main content
15,921,210 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 ...........
Posted
Updated 1-May-14 20:17pm
v2
Comments
Richard MacCutchan 2-May-14 5:33am    
AND husbandAge < wifeAge ... ?
Prasanth Radhakrishanan 14-May-14 3:49am    
thank u sir i got answer below pls check

add one field gender at the time of fill the personal detail and match age gender ='male' and
 
Share this answer
 
SQL
if @gender='male'
      begin
      set @gender='female'

SQL
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

SQL
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900