Once you have determined how much you'd like to spend for house payment (including insurance and taxes), you come up with the loan amount and a price range for the home. Sunnyvale and Campbell are desirable locations but they are not exactly close. I am wondering how you chose those two areas. Where do you work? There are other areas in the San Jose area that may be more affordable than Sunnyvale and Campbell. Since you are considering the purchase of a condo or townhome, you will also have to add HOA fees to your monthly budget.
Best of luck and happy new year.