Subject | Calling a SP without modify the 'from ***' statement |
---|---|
Author | korkless |
Post date | 2010-01-27T09:26:14Z |
hi all, i have this 2 table (there i simplify them)
Users
{
integer ID
}
Documents
{
integer ID,
integer USER_ID //it's a FK
timestamp CREATION_TIME
}
now i have this query
select u.ID from Users u
i need to modify that to have also the last document but i can change only the select statement, not the from ***,
so i think to write a procedure (it's pseudo-code)
integer GET_ID_OF_LAST_DOCUMENT_FOR_THIS_USER(integer userID)
and use a select as
select u.ID, GET_***_USER(u.ID) from User u
but i try a bit but it seems impossible, i'm right or exists same way to call a procedure in the 'SELECT ***' statement without change the 'FROM ***' ?
Users
{
integer ID
}
Documents
{
integer ID,
integer USER_ID //it's a FK
timestamp CREATION_TIME
}
now i have this query
select u.ID from Users u
i need to modify that to have also the last document but i can change only the select statement, not the from ***,
so i think to write a procedure (it's pseudo-code)
integer GET_ID_OF_LAST_DOCUMENT_FOR_THIS_USER(integer userID)
and use a select as
select u.ID, GET_***_USER(u.ID) from User u
but i try a bit but it seems impossible, i'm right or exists same way to call a procedure in the 'SELECT ***' statement without change the 'FROM ***' ?