Joystick pins

can anybody tell me how can we connect joystick pins i.e X and Y pins with one analog pins?????

Or we have to solve this problem with code???

You cannot sensibly read 2 analogue signals, ie X and Y, using a single Arduino pin. You need to use a separate pin for each axis. Connect the 2 ends of the pot tracks to 5V and GND respectively and the centre connection to an analogue input pin, one for each axis