Jump to content

doublet216

Members
  • Posts

    10
  • Joined

  • Last visited

doublet216's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks! It's been sometime since I have done actual queries.
  2. Original Query Competition Arist Artwork art_id artist_id file competition_id art_id | artist_id | file | competition_id | ---------------------------------------------------------------- 1 | 2 | images/aaa.jpg | 1 2 | 2 | images/bbb.jpg | 1 3 | 5 | images/ccc.jpg | 1 4 | 5 | images/fun.jpg | 1 Competition Artwork Review art_id artist_id juror_id score competition_id Table 2 art_id | artist_id | juror_id | score | competiton_id ----------------------------------------------------------------- 1 | 2 | 5 | 5 | 1 The oringal query should result in art_id | artist_id | file | competition_id | Score | ----------------------------------------------------------------------------- 1 | 2 | images/aaa.jpg | 1 | 5 | 2 | 2 | images/bbb.jpg | 1 | null | 3 | 5 | images/ccc.jpg | 1 | null | 4 | 5 | images/fun.jpg | 1 | null |
  3. I did run it in mysql, all I get is 1 row art_idd 1 artist_id 2 file images/aaa.jpg score 5 juror_id 5
  4. Don't think that fixes it, If I just do SELECT t1.art_id, t1.artist_id, t1.file, t2.score, t2.juror_id FROM table_one t1 RIGHT JOIN table_two t2 ON t1.art_id = t2.art_id WHERE t2.juror_id = 5 AND t1.competition_id = 1 I still just get the 1 result, I need to get art_id | artist_id | file | competition_id | Score | ----------------------------------------------------------------------------- 1 | 2 | images/aaa.jpg | 1 | 5 | 2 | 2 | images/bbb.jpg | 1 | null | 3 | 5 | images/ccc.jpg | 1 | null | 4 | 5 | images/fun.jpg | 1 | null |
  5. I am trying to join 2 tables, retrieve all the data from one table as well as a column from another table on 2 where conditions. Here are my tables. Table 1 art_id | artist_id | file | competition_id | ---------------------------------------------------------------- 1 | 2 | images/aaa.jpg | 1 2 | 2 | images/bbb.jpg | 1 3 | 5 | images/ccc.jpg | 1 4 | 5 | images/fun.jpg | 1 Table 2 art_id | artist_id | juror_id | score | competiton_id ----------------------------------------------------------------_ 1 | 2 | 5 | 10 | 1 As you can see, Table 2 has 1 entry, I need to join table 2 with table 1 to show the score. So my end results should be. art_id | artist_id | file | competition_id | Score | ----------------------------------------------------------------------------- 1 | 2 | images/aaa.jpg | 1 | 5 | 2 | 2 | images/bbb.jpg | 1 | null | 3 | 5 | images/ccc.jpg | 1 | null | 4 | 5 | images/fun.jpg | 1 | null | Here is my query, but it just returns the 1 result. SELECT t1.art_id, t1.artist_id, t1.file, t2.score, t2.juror_id FROM table_one t1 RIGHT JOIN table_two t2 ON t1.art_id = t2.art_id AND t1.artist_id = t2.artist_id WHERE t2.juror_id = 5 AND t1.competition_id = 1
  6. its an excel document with 2 columns and 4 rows. param_name | param_val name 2 | value2 name | value name1 | value1
  7. I am stuck getting a CSV file that I upload into an array in javascript. So far my file upload gives me. param_name,param_val "name2","value2" "name","value" "name1","value1" I need to just grab the values inside the " ". So I would need an array to go like array( [0] name2 => value 2 [1] name => value [2] name1 => value 1 ) I am stuck and can't seem to get it how I need it. Can anyone help? I have tried replacing and splitting but with no such luck. Any push in the right direction is appreciated. My Excel CSV looks like this param_name | param_val name 2 | value2 name | value name1 | value1
  8. I have a 2 dimensional array and I can't seem to get the difference between 2 arrays. Array ( [LineItem] => Array([1] => 1) [Product] => Array([1] => 1) ) Array ( [Product] => Array([1] => 1) ) $diff = array(); foreach($group as $key => $value) { foreach($group2 as $key2 $value2) { if($value[$key1] == $value2[$key2]) continue 2; } $diff[] = $value; } what i need is $diff to be Array ( [LineItem] => Array([1] => 1) )
×
×
  • 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.