Jump to content

dewdo

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Posts posted by dewdo

  1. I am trying to sum fields across rows if a specific condition is true, for example if field 1 from row2 = field 1 from row 4 then SUM field 3 from both row1 and row 4.  except the query has to be more general since there are hundreds of rows .... thanks.


  2. Thanks for the reply.
    the result set I am looking for is not as specific as that statement seems to require.

    I need a result set that looks like this:

                      Type 1 | Type 2 | Type 3 | Type 4
              CP 1      NO        YES      NO      NO
              CP 2      YES        YES      NO      NO
              CP 3      NO        NO        NO      NO
              CP 4      NO        NO        YES      NO

    Ideas?
  3. My apologies, i just replied to my last message on this thread b/c it was a smilar problem.

    I made the modification you suggested by get "Incorrect syntax near the keyword 'ORDER'." I did a search but did not see the answer ... do you have any thoughts?
  4. that query did not end up working ...

    i have this structure

    I have three tables

    AllSTypes                          AllCPS                 
    |types|                            |CPS|                 
    type 1                              CP 1
    type 2                              CP 2
    type 3                              CP 3
    type 4                              CP 4



    AllCombo
    |CPS|      |types|      |APSID|
    CP 1        type 2        1
    CP 2        type 1        2
    CP 2        type 2        3
    CP 4        type 3        4


    I need results that show a full list of Types and CPS and then says whether there is an entry for that combo in AllCombo or not... that part i think we agree on
  5. I have three tables

    AllSTypes                          AllCPS                 
    |types|                            |CPS|                 
    type 1                              CP 1
    type 2                              CP 2
    type 3                              CP 3
    type 4                              CP 4



    AllCombo
    |CPS|      |types|      |APSID|
    CP 1        type 2        1
    CP 2        type 1        2
    CP 2        type 2        3
    CP 4        type 3        4


    I need results that show a full list of Types and CPS and then says whether there is an entry for that combo in AllCombo or not...

    ideas?




  6. label2.

    I am trying to achieve a list where every type of car is shown (table 1), every possible color is shown (table 2) and then a column is inserted that says whether that car comes in that color (table 3). Except, table 3 just has entries where a car does come in that color. I need the results to yes, if its in table three, or no if its not in table three ....
  7. $sql = "SELECT DISTINCT tb1.label, tb2.label2 FROM tb1, tb2, tb3 WHERE '(SELECT tb2.label2 FROM tb2 LEFT JOIN tb3 ON tb2.label2 = tb3.label2)'";

    why wont this work?

    I am trying to display the entire contents of two tables and then show which of the rows match are recorded together in a third table.
  8. $sql = "SELECT DISTINCT tb1.label, tb2.label2 FROM tb1, tb2, tb3 WHERE '(SELECT tb2.label2 FROM tb2 LEFT JOIN tb3 ON tb2.label2 = tb3.label2)'";

    why wont this work?

    I am trying to display the entire contents of two tables and then show which of the rows match are recorded together in a third table.
  9. thank you, that was helpful.

    If there are three tables [ptypes], [cparties], [eligible]

    ptypes have all of label1 and cparties have all of label2, eligible matches some of label1 and label2. I need to show a complete list such that there is all ptypes and all cparties and then a yes/no based on what is in eligible ....

    would this be a union or embedded left join of some sort?
  10. I have a table that has a complete set of labels. I have another table that assigns some labels to some users. I want to create a list that prints the complete set of labels and then says whether it has been assigned to the user or not.

    table one:
    label 1
    label 2
    label 3
    label 4

    table two:
    user1 | label 1
    user2 | label 2

    desired output:
    label 1 | user1 | yes
    label 2 | user1 | yes
    label 3 | user1 | no
    label 4 | user1 | no

    any ideas?

    thanks
×
×
  • 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.