Question

I have two tables gcm_users and vechicle_master with me.

gcm_users has session id named ID which is generated automatically*(A_I Primary Key)* when user registers.I use this session id in my query to identify the user at time of log in.

requirement - i want to show all the vehicle details from vehicle_master table which are related with the user from the gcm_user table.

NOTE: when a user logs in, he should only see his own vehicle details.

Was it helpful?

Solution

Try using JOIN you can do like, put your user_id in place of 1

SELECT a.*
FROM vehicle_master a 
JOIN gcm_users b
ON a.registration_no = b.registration_no
WHERE user_id =  1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top