Web Analytics Made Easy -
StatCounter combining 2 fields in a single mysql select query - CodingForum

Announcement

Collapse
No announcement yet.

combining 2 fields in a single mysql select query

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • combining 2 fields in a single mysql select query

    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

  • #2
    i think you need something like this
    Code:
    SELECT a.pageheader, b.name FROM table1 a, table2 b WHERE a.id = b.id
    Free php image upload script
    Personal web developing blog

    Comment


    • #3
      hi,

      i want to combine two fields of same table in a single select query along with some other fields of second table.how i can do this.one field contains <div id="d"></div> ans second field contains content like 'abcd".the second table contains css styles

      thanks

      mrjameer

      Comment


      • #4
        Is your question about fetching the data or about inserting it into the html (<div...</div>)?

        Are you asking for full sql syntax?
        Active PHP/MySQL application developer available for immediate work.
        syosoft.com mavieo.com - Remote Web Site Administration Suite - Reseller Ready

        Comment


        • #5
          If you mean you need the SQL for getting 2 fields out of a table , then it would be

          Code:
          SELECT field1, field2 FROM table WHERE parameters

          Comment


          • #6
            combining 2 fields in a single mysql select query

            SELECT concat( <field1>, ' ', <field2> ) AS single FROM <your_table>

            Comment

            Working...
            X