How to query with custom fields ?

How to query with custom fields ?

1- If i am fetching all tickets then it won't show me custom fields. How can i do that ?
2- I need to query my result with the help of custom fields ?

It is very urgent.