Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6250637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:27:45+00:00 2026-05-24T13:27:45+00:00

this is my database: When I try with mysql this query all goes good:

  • 0

this is my database:
enter image description here

When I try with mysql this query all goes good:

SELECT *
FROM privati AS p
INNER JOIN richiestepreventivo AS r
      ON p.id = r.idPrivato
WHERE r.idImpresa = xx

But If I do:

$qr = Doctrine_Query::create()
                ->select('*')
                ->from('privati as p')
                ->innerJoin('richiestepreventivo as r ON p.id=r.idPrivato ')
                ->where('r.idImpresa=' . $idI);

But gives me this error:

Unknown relation alias 

This is my YAML file:

    ---
detect_relations: true
options:
  collate: latin1_swedish_ci
  charset: latin1
  type: InnoDB

exclienti:
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
    regione:
      type: string(25)
      notnull: true
    data_reg:
      type: date
      notnull: true
      default: '0000-00-00'
    provincia:
      type: string(2)
      notnull: true
    azienda:
      type: string(25)
      notnull: true
    telefono:
      type: string(25)
      notnull: true
    email:
      type: string(25)
      notnull: true
    RM:
      type: integer(4)
      notnull: true
    p1:
      type: string(2)
      notnull: true
    p2:
      type: string(2)
      notnull: true
    p3:
      type: string(2)
      notnull: true
    p4:
      type: string(2)
      notnull: true
    p5:
      type: string(2)
      notnull: true
    p6:
      type: string(2)
      notnull: true
    p7:
      type: string(2)
      notnull: true
    p8:
      type: string(2)
      notnull: true
    note:
      type: string(255)
      notnull: true
    prevInviati:
      type: integer(4)
      notnull: true
      default: '0'
    nIscrizioni:
      type: integer(4)
      notnull: true
      default: '0'
    idImpresa:
      type: integer(4)
      notnull: true
    data_form:
      type: date
      notnull: true
      default: '0000-00-00'
  options:
    charset: latin1

imprese:
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    regione:
      type: string(25)
      notnull: true
    data_form:
      type: date
      notnull: true
    data_reg:
      type: date
      default: '0000-00-00'
    provincia:
      type: string(2)
      notnull: true
    azienda:
      type: string(25)
      notnull: true
    telefono:
      type: string(25)
      notnull: true
    email:
      type: string(25)
      notnull: true
    RM:
      type: integer(4)
      default: '0'
    p1:
      type: string(2)
      notnull: true
      default: ''
    p2:
      type: string(2)
      notnull: true
      default: ''
    p3:
      type: string(2)
      notnull: true
      default: ''
    p4:
      type: string(2)
      notnull: true
      default: ''
    p5:
      type: string(2)
      notnull: true
      default: ''
    p6:
      type: string(2)
      notnull: true
      default: ''
    p7:
      type: string(2)
      notnull: true
      default: ''
    p8:
      type: string(2)
      notnull: true
      default: ''
    note:
      type: string(255)
      default: ''
    prevInviati:
      type: integer(4)
      notnull: true
      default: '0'
    nIscrizioni:
      type: integer(4)
      default: '0'
  options:
    charset: latin1

privati:
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    data:
      type: date
      default: null
    regione:
      type: string(20)
      default: null
    provincia:
      type: string(20)
      default: null
    nome:
      type: string(25)
      default: null
    telefono:
      type: string(25)
      notnull: true
    email:
      type: string(30)
      default: null
    richiesta:
      type: string(255)
      default: null
    cod1:
      type: integer(4)
      default: '0'
    cod2:
      type: integer(4)
      default: '0'
    cod3:
      type: integer(4)
      default: '0'
    cod4:
      type: integer(4)
      default: '0'
    cod5:
      type: integer(4)
      default: '0'
    note:
      type: string(255)
      default: null
  options:
    charset: latin1

richiestepreventivo:
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    idPrivato:
      type: integer(4)
      notnull: true
    idImpresa:
      type: integer(4)
      notnull: true
    data_invio:
      type: date
      notnull: true
  relations:
    idImpresa:
      class: imprese
      local: idImpresa
      foreign: id
      foreignAlias: richiestepreventivoes
      onDelete: cascade
    idPrivato:
      class: privati
      local: idPrivato
      foreign: id
      foreignAlias: richiestepreventivoes
  indexes:
    1 impresa piu richieste preventivo:
      fields: [idImpresa]
    FKRichiesteP160761:
      fields: [idPrivato]
  options:
    charset: latin1

What is wrong?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:27:46+00:00Added an answer on May 24, 2026 at 1:27 pm

    It should be ->innerJoin('p.richiestepreventivo as r ON p.id=r.idPrivato ')

    UPDATE: try

    $qr = Doctrine_Query::create()
                ->select('*')
                ->from('privati p')
                ->innerJoin('p.richiestepreventivo r ON p.id=r.idPrivato ')
                ->where('r.idImpresa=' . $idI);
    

    I have some working code that do almost the same and there is no as in it. And, just in case, please check your generated model classes, DQL is case-sensitive. From your YAML it is clear they should be lowercase, but maybe somebody renamed them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I try to ask is how to select from database record and my
I used this query to insert all my values into this database: INSERT INTO
I'm trying to run this simple query: try { $dsn = mysql:host=localhost;dbname:mydb; $PDO =
I'm using the following mysql query to return some data from my database. Currently
I'm writing a python CGI script that will query a MySQL database. I'm using
After posting this question MySQL update or insert or die query I've change to
I'm trying to delete one row of data from a MySQL database (innodb) in
This is what I'm trying to achieve. If All is selected from the drop
This database will store a list of children. But the problem is, they will
I'm using this database where the date colomn is a numeric value instead of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.