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 6937257
In Process

The Archive Base Latest Questions

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

ownself = db.session.query(User.id.label(user_1_id), User.id.label(user_id)) User2 = aliased(User) FacebookUser2 = aliased(FacebookUser) friends = (db.session.query(User2.id.label(user_1_id), User.id.label(user_id)).

  • 0
ownself = db.session.query(User.id.label("user_1_id"), User.id.label("user_id"))

User2 = aliased(User)
FacebookUser2 = aliased(FacebookUser)
friends = (db.session.query(User2.id.label("user_1_id"), User.id.label("user_id")).
           join(FacebookUser2, User2.facebook_info == FacebookUser2.id).
           join(FriendConnection, FacebookUser2.id == FriendConnection.fb_user_from).
           join(FacebookUser, FacebookUser.id == FriendConnection.fb_user_to).
           join(User, User.facebook_info == FacebookUser.id)
           )

u_all = union_all(ownself, friends)

q = (db.session.query(User).filter(u_all.c.user_id == user.id))

I get the error “Every derived table must have its own alias” with MySQL, how can I fix this?

  • 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-27T12:20:24+00:00Added an answer on May 27, 2026 at 12:20 pm

    I think the comment in your other question should cover this now: just add .alias("alias_name") to the (partial) query in question.
    In your code example, add it to both sub-queries:

    # old:
    u_all = union_all(ownself, friends)
    # new:
    u_all = union_all(ownself.alias("subquery1"), friends.alias("subquery2"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I configure my web application to use SSL using my own self signed certificate.
I am using OpenSSL to construct my own self signed certificate which I have
I'm using Leiningen to automate the creation of a single 'uberjar' from several dependencies.
I know that even a question Erlang or Java seems quite strange, because they
Are there any limitations with respect to developing ASP.NET and WPF apps using VS
I'm trying to wrap my head around the basic concepts of the R programming
I'm currently using Wordpress.com to host my blog, but I would like more control
I created a table with 2 sections , I want the app when press
I'm using the static code analyser in objective C and I found that using
Is there a way to install my own self-signed SSL certificate on my iPad?

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.