Take the tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am new to this node.js and postgres.. I am executing 2 queries(select) and i have to combie these 2 queries output into a single result. Also i have to make the 1st result to appear first and then the 2nd query.. I have the following code but i am not achieving the requirement. Also i am not sure that the code i have is correct..Suggest other idea if you have..

My code:

  client.query("select * from tn_village where level3 ILIKE '%"+villagename+"%' OR level4 ILIKE '%"+villagename+"%' OR level5 ILIKE '%"+villagename+"%' OR level6 ILIKE '%"+villagename+"%' OR level7 ILIKE '%"+villagename+"%' OR level8 ILIKE '%"+villagename+"%' OR level9 ILIKE '%"+villagename+"%'",function(err,result)
    {
    client.query("select * from tn_village where level3 ILIKE '%"+village+"%' OR level4 ILIKE '%"+village+"%' OR level5 ILIKE '%"+village+"%' OR level6 ILIKE '%"+village+"%' OR level7 ILIKE '%"+village+"%' OR level8 ILIKE '%"+village+"%' OR level9 ILIKE '%"+village+"%'" ,function(err,result1)
    {      
    res.send(result1);
    });
    });

How can i combine result and result1 to a single output..Help me to solve this..Thanks in advance..

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.