mrjameer Posted September 28, 2006 Share Posted September 28, 2006 hi,i want to combine 2 fields in a single select queryfields. pageheader namevalues. abcd <div id="d"></div> i want to merge/combine the pageheader and name in a single select query so that it can retrieve the pageheader with some styles which i have stored in another tablethanksmrjameer Quote Link to comment https://forums.phpfreaks.com/topic/22437-combining-2-fields-in-a-single-mysql-select-query/ Share on other sites More sharing options...
yonta Posted September 29, 2006 Share Posted September 29, 2006 Shouldn't be too hard to search on this, but if both fields are in the same table just'SELECT field_one, field_two FROM tablename 'if they're in two separate tables'SELECT tablename_one.field_one, tablename_two.field_two FROM tablename_one, tablename_two 'and if they're somehow related use the WHERE clause Quote Link to comment https://forums.phpfreaks.com/topic/22437-combining-2-fields-in-a-single-mysql-select-query/#findComment-100603 Share on other sites More sharing options...
thedarkwinter Posted September 29, 2006 Share Posted September 29, 2006 not 100% sure what your going for but you can mess around with this and see if it helps:SELECT CONCAT(tbl1.pageheader,' ',tbl2.name) FROM tbl1 JEFT JOIN tbl2 ON tbl1.pageid=table2.pageid WHERE tbl1.pageid=1;CONCAT will join the strings to make 1 string... LEFT JOIN to get match the rows in the tables??hope thats not completely useless to you! Quote Link to comment https://forums.phpfreaks.com/topic/22437-combining-2-fields-in-a-single-mysql-select-query/#findComment-100759 Share on other sites More sharing options...
mrjameer Posted September 29, 2006 Author Share Posted September 29, 2006 hi,i want to store css styles(simple box) in one table and in another table divs as one field and content as another field.so that when i combine these two tables in a select query i can get a some text in that box.how to do it.your help will be appreciated.i had stored styles and divs and content but when i retrieve it the content(text) is displaying outside of styles.i want to display the text in boxthanksmrjameer Quote Link to comment https://forums.phpfreaks.com/topic/22437-combining-2-fields-in-a-single-mysql-select-query/#findComment-101108 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.