문제

I have the following SQL query:

SELECT p.id, title, l.id, username FROM photoTable p JOIN userTable l ON (l.id = p.iduser) ORDER BY p.id DESC LIMIT 50

I need to change the p.id to p.IdPhoto but the problem is that I only want this done temporarily within the call. I have seen ALTER TABLE as an option, but I am a bit unsure of how I can do this without altering both id fields. Any ideas?

도움이 되었습니까?

해결책

Would this work?

SELECT p.id as idPhoto, title, l.id, 
username 
FROM photoTable p 
JOIN userTable l ON (l.id = p.iduser) 
ORDER BY p.id DESC LIMIT 50
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top