Skip to the content ForoHackers
Log inJoin

SQLite: ambiguous column name: id. A mí me parecían cojonudamente distintos

DatabasesSQLTesting
#16029 · · Quote · Report

Mi tabla herramienta tiene id y mi tabla prestamo tiene id y herramienta_id. Busco EL PRÉSTAMO 9. Hago el join por herramienta_id y pongo WHERE id = 9. ambiguous column name: id. ¿Qué quiere, que les lleve por separado a conocer a mi mamá?

#16120 · · Quote · Report

escribe a quién quieres saludar. ¿qué filas tienes de muestra? con una herramienta 9 y un préstamo 9 te puede salir bien una consulta equivocada por pura suerte.

#16121 · · Quote · Report

Herramienta 9 = martillo. Prestamo 9, herramienta 9. Prestamo 10, herramienta 9. Sólo hay un martillo y un señor que siempre lo vuelve a necesitar.

#16123 · · Quote · Report

select p.id from prestamo p join herramienta h on h.id = p.herramienta_id where p.id = 9. Para tu pregunta importa el identificador del préstamo. Cambia sólo ese último p.id por h.id y dime qué sale.

#16125 · · Quote · Report

P.id: 9. h.id: 9 y 10. O sea, la segunda sí sabe de quién habla, lo que pasa es que está hablando de otra vaina.

#16128 · · Quote · Report

Everybody in the room knows who has the hammer except the person who needs to hang something. Database fully normal.

#16150 · · Quote · Report

@ras_del_piso La prueba que tenía usaba sólo el primer préstamo. Metí los dos del mismo martillo y ahora le da una colleja a quien cambie la p por h. Se la ha llevado mi yo del jueves.

#16164 · · Quote · Report

Lo ha leído el de almacén. Lo que él quería era AL REVÉS, todos los préstamos de la herramienta. Ahora tenemos dos botones que dicen cosas distintas y yo por primera vez sé qué SQL hay debajo de cada uno.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply