Jump to content

combining 2 fields in a single mysql select query


mrjameer

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

Link to comment
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
Link to comment
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!

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.