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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:59:39+00:00 2026-06-17T17:59:39+00:00

I am compiling a raw statement where I need to assign previous query result

  • 0

I am compiling a raw statement where I need to assign previous query result to a variable and use it as an id for the next query. Unfortunately I don’t remember how to do it in SQL.

This is what I get

01-18 18:22:22.443: E/AndroidRuntime(5801): android.database.sqlite.SQLiteException: near "AS": syntax error (code 1): , while compiling: SELECT _id,date,title,description, (SELECT title FROM discipline WHERE _id=gdid ) AS discipline_title FROM alert WHERE _id=(SELECT eaid FROM alert_to_discipline) AS gdid

I suspect that AS gdid is a wrong way to make it a variable. How do I do it?

Here is more-nicely formatted query

SELECT _id,date,title,description,
    (SELECT title FROM discipline WHERE _id=gdid ) AS discipline_title
        FROM alert WHERE _id=(SELECT eaid FROM alert_to_discipline) AS gdid
  • 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-06-17T17:59:41+00:00Added an answer on June 17, 2026 at 5:59 pm

    I had this experience too. You can’t use temporary variables in SQLite. The best way is just to run a query and assign it to a java declared variable. Then pass it in for the second query.

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

Sidebar

Related Questions

Raw data as result of a create view data as select [...] statement: projectId
I've just started on some raw network programming in C++ and have been compiling
How can I build a query in ORMLite so that I can use the
Compiling a kernel module on 32-Bit Linux kernel results in __udivdi3 [mymodule.ko] undefined! __umoddi3
Compiling this code with g++ 4.7.0 ( -Wall -Wextra -Werror -Wconversion -std=c++11 ): #include
In compiling qt I found that there is a qws target called arm-linux-gcc. I
When compiling a c file that uses old style function definition like int foo(a)
When compiling shared libraries in gcc the -fPIC option compiles the code as position
When compiling : #include <vector> template<class T> class foo { void bar() { std::vector<T>
When compiling my wxWidget HelloWorld application, I am getting the following errors: Warning 1

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.