| Author |
Topic |
|
Blug
Starting Member
9 Posts |
Posted - 2011-04-06 : 09:34:01
|
| OK, lets say I have a table with the following attributes...{FirstName, LastName, FullName}Example Tuples..{Bob, Tucker, Bob Tucker}{John, Spark, John Spark}{Sarah, Mitchell, Sarah Thomas}ext.Anyways, what I want to know is, how would I go about making a query something like...select * from Names where FirstName like %FullName% and LastName like %Fullname%;I dunno, do you see what I mean?I'm really stuck on this thanks! |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-04-06 : 09:49:34
|
Not sure exactly the logic that you are trying to implement, but one of these?FullName like FirstName+ ' ' + '%' and FullName like '%' + ' ' + LastName You could combine the space and the %; I broke it out into two pieces just so the logic is clear |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-04-06 : 09:50:55
|
where FullName like '%'+Firstname+'%' and FullName like '%'+Lastname+'%' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Blug
Starting Member
9 Posts |
Posted - 2011-04-06 : 10:02:56
|
| Wait... are you trying to say that you can concatenate in sql? Because if that's the case it makes things alot more easier.Thanks for that! |
 |
|
|
Blug
Starting Member
9 Posts |
Posted - 2011-04-06 : 10:16:15
|
| Now, I'm getting an error message saying 'Invalid number'.Is it something to do with me having a + sign in between 2 type chars?? |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2011-04-06 : 10:18:42
|
quote: Originally posted by Blug Now, I'm getting an error message saying 'Invalid number'.Is it something to do with me having a + sign in between 2 type chars?? no.
Can you show us what you attempted to run?Corey I Has Returned!! |
 |
|
|
Blug
Starting Member
9 Posts |
Posted - 2011-04-06 : 10:26:11
|
| ok, well heres a bit of a longer version.select F.Title from films F join Roles R on F.FilmID = R.FilmID join ArtistID A on R.ActorID = A.ArtistID where F.Director like (A.Firstname + ' ' + A.Surname); |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-04-06 : 13:10:28
|
quote: Originally posted by Blug ok, well heres a bit of a longer version.select F.Title from films F join Roles R on F.FilmID = R.FilmID join ArtistID A on R.ActorID = A.ArtistID where F.Director like (A.Firstname + ' ' + A.Surname);
The table name is really ArtistID?? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|