Jump to content

Archived

This topic is now archived and is closed to further replies.

mrjameer

combining 2 fields in a single mysql select query

Recommended Posts

hi,

i want to combine 2 fields in a single select query

fields. pageheader name
values. 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 table

thanks
mrjameer

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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 box

thanks
mrjameer

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.