Subject | Part of string into JOIN statement |
---|---|
Author | majstoru |
Post date | 2006-04-11T19:50:43Z |
Hi,
I have two tables with data like this sample:
STATUS table:
id status
1010001 idle
1010002 close
1020003 statusx
1020002 finish
USERS table
id name
001 User_name1
002 User_name2
003 User_name3
like you can see, firs 4 chars of id from status table are not
important for JOIN table users in SQL statement!
My problem is how to write SELECT statement which will cut first 4
letters from id from STATUS table (Sample 1010001 -> 001) and join
USERS table on STATUS table by this these 3 letters (Sample 001)
Thaks...
I have two tables with data like this sample:
STATUS table:
id status
1010001 idle
1010002 close
1020003 statusx
1020002 finish
USERS table
id name
001 User_name1
002 User_name2
003 User_name3
like you can see, firs 4 chars of id from status table are not
important for JOIN table users in SQL statement!
My problem is how to write SELECT statement which will cut first 4
letters from id from STATUS table (Sample 1010001 -> 001) and join
USERS table on STATUS table by this these 3 letters (Sample 001)
Thaks...