LittleNicky Posted August 3, 2006 Share Posted August 3, 2006 Hi,Does anyone know how I concatenate 2 fields together?For example I want to say "SELECT * mytable WHERE a_php_variable='field1 concatentated with field2'" Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 3, 2006 Share Posted August 3, 2006 I am not sure about the constructor, but it may be this:SELECT * mytable WHERE {$a_php_variable}=(field1 + field2)This doesn't concatenate the fields, but checkes a value against the values of the one field glued to the value of the other. It can be like this too:SELECT * mytable WHERE field1 + field2 = '{$a_php_variable}'Which looks more logical Link to comment Share on other sites More sharing options...
LittleNicky Posted August 3, 2006 Author Share Posted August 3, 2006 I am not sure about the constructor, but it may be this:SELECT * mytable WHERE {$a_php_variable}=(field1 + field2)This doesn't concatenate the fields, but checkes a value against the values of the one field glued to the value of the other. It can be like this too:SELECT * mytable WHERE field1 + field2 = '{$a_php_variable}'Which looks more logical Ok so would this work:SELECT * mytable WHERE firstname + " " + lastname= '{$fullname}'if $fullname equals 'firstname lastname' Link to comment Share on other sites More sharing options...
aspnetguy Posted August 3, 2006 Share Posted August 3, 2006 I think that should work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now