Query Problem

Discussion in 'MySQL' started by chtdatweb, Mar 22, 2011.

  1. #1
    Hi All,

    I have this query and im not sure why it is not working. Im hoping someone can help me out.

    Query:

    SELECT DISTINCT rate, lcdial_providers.dialstr,'0', lcdial_providers.id, lcdial_providers.provider
    FROM lcdial_rates
    LEFT JOIN lcdial_providers ON lcdial_providers.provider=lcdial_rates.provider
    LEFT JOIN lcdial_prefix_control ON lcdial_prefix_control.active=lcdial_rates.active
    WHERE lcdial_providers.enabled = 1
    AND prefix='44'
    AND lcdial_prefix_control.active='1' ORDER BY length(prefix)
    DESC, lcdial_rates.rate ASC;

    Result:

    result: ERROR 1054 (42S22): Unknown column 'lcdial_rates.active' in 'on clause'

    Table Structure for lcdial_rates:

    prefix
    provider
    rate
    note
    id
    network
    enabled

    Table Structure for lcdial_prefix_control:

    prefix_control
    provider
    rate_control
    note
    id
    network
    active

    Table Structure for lcdial_providers:

    id
    provider
    dialstr
    enabled
    network

    Any ideas?
     
    chtdatweb, Mar 22, 2011 IP
  2. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #2
    What do you think this is trying to tell you?

    result: ERROR 1054 (42S22): Unknown column 'lcdial_rates.active' in 'on clause'


    Its pretty straight forward. You do not have a field called 'active' in your lcdial_rates table.
     
    plog, Mar 22, 2011 IP
  3. jkl6

    jkl6 Peon

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Haha Nice one
     
    jkl6, Mar 22, 2011 IP