문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top