Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mySQL query

Discussion in 'Website Design Forum:' started by chrismitchell, Jul 10, 2011.

Thread Status:
Not open for further replies.
  1. Hi everyone.. I need a mySQL query to call 2 columns from 2 different tables in a database.

    Can anyone help me?

    my available variables are: %WHERE%, %HAVING%, %ORDERBY% and %LIMIT%

    any help would be great :)
     
  2. this is what I have so far:

    Code:
     SELECT ID,value FROM wp_wpsc_submited_form_data WHERE value='*'SELECT ID,name FROM wp_wpsc_variation_values WHERE name='*'
    I just need to know how to make the SQL call those 2 columns to make the export work.

    Any help?
     
  3. openmind

    openmind Senior Member

    Well assuming there is a unique reference in each table then you could use a JOIN statement.
     
  4. I now have a bit more if anyone can help me.. I need to combine an entire row to make it display the whole name and address of the customer.. but all the information is in a row called value. I can get it to display each bit of information but it doesn't group the information from the value column. Here is the mySQL that I have:

    SELECT value,name FROM wp_wpsc_submited_form_data
    JOIN wp_wpsc_variation_values

    value is from the form_data table and name is from the variation_values table. The variation_values table is fine, its just the form_data table that I need the value column to be combined.

    I've tried the GROUP_CONCAT command, but it doesn't work..

    Anyone else have any ideas?
     
  5. gwebhostuk

    gwebhostuk Junior Member

    Do you have any common field between both tables?
    If yes, then only you can apply 'join' to them and get the result.
     
  6. unfortunately the JOIN function doesn't work in this instance. Which is a bit rubbish, but never mind :)
     
  7. Hanson Web Design

    Hanson Web Design Junior Member

    Could you not put each query in a variable and then join the variables together?
     
  8. Its ok George, it all worked out in the end.. I hand coded a plugin to do the job for me LOL

    Thanks anway :)
     
Thread Status:
Not open for further replies.

Share This Page