mercredi 15 avril 2015

select value from second table which ID is in my first table


Vote count:

-1




I'm trying to select value from second table which ID is in my first table. I've tried this:



select
FIRST_NAME,
LAST_NAME,
c.name status
from STUDENTS
left join PAYER_STATUS c on Status = c.ID
where status like N'%'||'active'||'%';!


but it displays nothing. Here's just empty everything. But If I'll change active to 0 it displays in status column words active. for 1 inactive etc.


tables here


How can I solve that?



asked 4 mins ago

George

270

1 Answer



Vote count:

0




use your column name in where clause. coz you have status column present in table. so it will check the passed value with that column instead of c.name



select
FIRST_NAME,
LAST_NAME,
c.name status
from STUDENTS
left join PAYER_STATUS c on Status = c.ID
where c.name like N'%'||'active'||'%';!


answered 56 secs ago






select value from second table which ID is in my first table

Aucun commentaire:

Enregistrer un commentaire