join 兩個表以上會報錯

6 views
Skip to first unread message

SeedSeek

unread,
Aug 12, 2017, 10:38:25 PM8/12/17
to Uliweb
(psycopg2.ProgrammingError) table name "user_children" specified more than once [SQL: 'SELECT user_children."user", user_children.lang, user_children.content, user_children.content_j, user_children.parent, user_children.chinese_name, user_children.center, user_children.department, user_children.job_title, user_children.job_type, user_children.take_office_date, user_children.working_hours, user_children.job_agent_range, user_children.director_range, user_children.office_tel, user_children.office_tel_ext, user_children.office_email, user_children.marital_status, user_children.sex, user_children.birthday, user_children.blood_type, user_children.contact_addr, user_children.contact_tel, user_children.residence_addr, user_children.residence_tel, user_children.email, user_children.msn, user_children.cellphone, user_children.user_rank, user_children.index_hide, user_children.leave_office_status, user_children.leave_office_date, user_children.apply_no_flow, user_children.no_signin, user_children.mod_self_signin, user_children.mod_self_work_apply, user_children.shop, user_children.sync, user_children."order", user_children.status, user_children.slug, user_children."Create_time", user_children."Modify_time", user_children.id \nFROM user_children JOIN "user" ON "user".slug = user_children."user", user_children JOIN am_system_option ON am_system_option.slug = user_children.job_title, user_children JOIN center_main ON center_main.slug = user_children.center \nWHERE true']

Chunlin Zhang

unread,
Aug 13, 2017, 9:29:26 PM8/13/17
to uli...@googlegroups.com
什么错误信息?

On Sun, Aug 13, 2017 at 10:38 AM, SeedSeek <frt5...@gmail.com> wrote:
(psycopg2.ProgrammingError) table name "user_children" specified more than once [SQL: 'SELECT user_children."user", user_children.lang, user_children.content, user_children.content_j, user_children.parent, user_children.chinese_name, user_children.center, user_children.department, user_children.job_title, user_children.job_type, user_children.take_office_date, user_children.working_hours, user_children.job_agent_range, user_children.director_range, user_children.office_tel, user_children.office_tel_ext, user_children.office_email, user_children.marital_status, user_children.sex, user_children.birthday, user_children.blood_type, user_children.contact_addr, user_children.contact_tel, user_children.residence_addr, user_children.residence_tel, user_children.email, user_children.msn, user_children.cellphone, user_children.user_rank, user_children.index_hide, user_children.leave_office_status, user_children.leave_office_date, user_children.apply_no_flow, user_children.no_signin, user_children.mod_self_signin, user_children.mod_self_work_apply, user_children.shop, user_children.sync, user_children."order", user_children.status, user_children.slug, user_children."Create_time", user_children."Modify_time", user_children.id \nFROM user_children JOIN "user" ON "user".slug = user_children."user", user_children JOIN am_system_option ON am_system_option.slug = user_children.job_title, user_children JOIN center_main ON center_main.slug = user_children.center \nWHERE true']

--
-- ----
Project : https://github.com/limodou/uliweb
doc : http://limodou.github.com/uliweb-doc
---
You received this message because you are subscribed to the Google Groups "Uliweb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uliweb+unsubscribe@googlegroups.com.
To post to this group, send email to uli...@googlegroups.com.
Visit this group at https://groups.google.com/group/uliweb.
To view this discussion on the web visit https://groups.google.com/d/msgid/uliweb/ce01032b-58e4-468b-87f1-93ccd9d64c41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

limodou

unread,
Aug 14, 2017, 9:56:13 AM8/14/17
to uliweb
是不是要给表加一个aliased别名,
http://docs.sqlalchemy.org/en/latest/changelog/migration_10.html#changes-and-fixes-in-handling-of-duplicate-join-targets
>> email to uliweb+un...@googlegroups.com.
>> To post to this group, send email to uli...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/uliweb.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/uliweb/ce01032b-58e4-468b-87f1-93ccd9d64c41%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> -- ----
> Project : https://github.com/limodou/uliweb
> doc : http://limodou.github.com/uliweb-doc
> ---
> You received this message because you are subscribed to the Google Groups
> "Uliweb" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to uliweb+un...@googlegroups.com.
> To post to this group, send email to uli...@googlegroups.com.
> Visit this group at https://groups.google.com/group/uliweb.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/uliweb/CAG2rzAkevwT%3D%3D6W%2B2JcCSJ_Zado4YfS4YDHx6tiqz%3DbQnKKknA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
UliWeb <<simple web framework>>: https://github.com/limodou/uliweb
My Blog: http://my.oschina.net/limodou

cnidance

unread,
Aug 14, 2017, 9:48:38 PM8/14/17
to uli...@googlegroups.com
解決方式似乎是這樣,在Uliweb 的 model 怎麼使用 aliased ?




~Ten ~


>> To post to this group, send email to uli...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/uliweb.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/uliweb/ce01032b-58e4-468b-87f1-93ccd9d64c41%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> -- ----
> Project : https://github.com/limodou/uliweb
> doc : http://limodou.github.com/uliweb-doc
> ---
> You received this message because you are subscribed to the Google Groups
> "Uliweb" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> To post to this group, send email to uli...@googlegroups.com.
> Visit this group at https://groups.google.com/group/uliweb.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/uliweb/CAG2rzAkevwT%3D%3D6W%2B2JcCSJ_Zado4YfS4YDHx6tiqz%3DbQnKKknA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
UliWeb <<simple web framework>>: https://github.com/limodou/uliweb
My Blog: http://my.oschina.net/limodou
--
-- ----
Project : https://github.com/limodou/uliweb
doc : http://limodou.github.com/uliweb-doc
---
You received this message because you are subscribed to the Google Groups "Uliweb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uliweb+unsubscribe@googlegroups.com.

To post to this group, send email to uli...@googlegroups.com.
Visit this group at https://groups.google.com/group/uliweb.

limodou

unread,
Aug 15, 2017, 10:38:24 AM8/15/17
to uliweb
Model.table 就是对应sqlalchemy的Table对象
>> >> email to uliweb+un...@googlegroups.com.
>> >> To post to this group, send email to uli...@googlegroups.com.
>> >> Visit this group at https://groups.google.com/group/uliweb.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/uliweb/ce01032b-58e4-468b-87f1-93ccd9d64c41%40googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > -- ----
>> > Project : https://github.com/limodou/uliweb
>> > doc : http://limodou.github.com/uliweb-doc
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Uliweb" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to uliweb+un...@googlegroups.com.
>> > To post to this group, send email to uli...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/uliweb.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/uliweb/CAG2rzAkevwT%3D%3D6W%2B2JcCSJ_Zado4YfS4YDHx6tiqz%3DbQnKKknA%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> I like python!
>> UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
>> UliWeb <<simple web framework>>: https://github.com/limodou/uliweb
>> My Blog: http://my.oschina.net/limodou
>>
>> --
>> -- ----
>> Project : https://github.com/limodou/uliweb
>> doc : http://limodou.github.com/uliweb-doc
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Uliweb" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to uliweb+un...@googlegroups.com.
>> To post to this group, send email to uli...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/uliweb.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/uliweb/CADCtg9-TKt_GyshyD8Szh%2BJJKu6V%3DDvxiVwDOY%3DG2hmGMrYKEg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> -- ----
> Project : https://github.com/limodou/uliweb
> doc : http://limodou.github.com/uliweb-doc
> ---
> You received this message because you are subscribed to the Google Groups
> "Uliweb" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to uliweb+un...@googlegroups.com.
> To post to this group, send email to uli...@googlegroups.com.
> Visit this group at https://groups.google.com/group/uliweb.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/uliweb/CAHLXMV_L6TkxXZMCrj9z%3DgU_6Ua%3Dxfq1k1Hk9%2BuR-q0-zCtPcw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages