In the United Kingdom, CCJs (county court judgments) usually last for six years. However, this can vary depending on the specifics of your case. It is always best practice to speak to a licensed solicitor or another legal professional when it comes to the specifics surrounding your own personal circumstances.
If you are trying to apply for a loan or a mortgage during the six years, the CCJ will more than likely have an impact on your application, obviously this depends on a lot of factors, but if the CCJ is recent, it doesn't matter how perfect all other areas of your application may be, this is something that lenders will still need to consider.
However, it's important to keep in mind that a CCJ is not the be-all and end-all when it comes to your credit profile. It is still possible to secure a mortgage or credit even with a CCJ on your account, it will just require specialist advice and exploring unconventional avenues, such as lenders you may not find on your typical high street.
Obviously, the chases of being approved by these lenders can be imparted by other negative marks on your file (e.g., missed payments). But with the right knowledge, and a true and honest reflection of your circumstances, then a professional experienced advisor could steer you in the right direction.