Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Jul 2009
    Posts
    152
    Thanks
    8
    Thanked 0 Times in 0 Posts

    very hard mysql query

    table one structure {node}:

    Code:
    nid        type             title                 created
    
    10          provider        test one              1298107010
    11          provider        test two              1298107555    
    12          provider        example one            1300524695 
    13          provider        example two            1298081391
    14          provider        example three          1298082340
    15          company         example four           1298083519
    16....      company         example five          1298083559
    table two structure {votingapi_vote}:
    Code:
    content_id      value    value_type
    
    10                1          option
    10                 0          option
    11                 1          option
    12                 0          option
    15                 3          percent
    15                 2          percent
    16.....            0          option
    i want:

    get 22 titles list

    Code:
    ...
    test one
    test two
    example one
    example two 
    ...
    [

    1, the value of nid is equals the value of content_id in table 2.

    the title list queue order is:

    1, first according to table 2 content_id descending the tile list(decending content_id using "For each content_id, the number of rows with value=1 minus the number of rows with value=0" )

    2, because table2 maybe less than 22 records and has the same value when the number of rows with value=1 minus the number of rows with value=0. when emerge this condition. using the created field in table 1 to descending the tile
    Last edited by runeveryday; 05-21-2011 at 07:15 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •