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

The Archive Base Latest Questions

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

i need to export a MySql Database to a SQLite database, im getting only

  • 0

i need to export a MySql Database to a SQLite database, im getting only the needed data from medias to make de SQLite database smaller as posible.

I have a Query that give to me only the animalsMedias or the plantsMedias that are related to the entry with the last version, published and not filed of an animal or a plant.

SELECT AM.*, max(A.version) AS version FROM animalsMedias AS AM INNER JOIN animals
AS A ON(AM.idAnimal = A.idAnimal AND A.filed = 0 AND A.published = 1) GROUP BY 
A.idLanguaje, A.idVersion;

And to get only the medias related i try to make a SELECT on “medias” table that only returns to me the medias that are related with the result of the previous select, so i put both in “IN()”, but im getting the error:

#1241 - Operand should contain 1 column(s)

That is the query:

SELECT * from medias 
WHERE idMedia IN(SELECT AM.*, max(A.version) AS version FROM
animalsMedias AS AM 
INNER JOIN animals AS A ON(AM.idAnimal = A.idAnimal AND A.filed = 0 
AND A.published = 1) 
GROUP BY A.idLanguaje, A.idVersion) 
OR idMedia IN(SELECT PM.*, max(P.version) AS version FROM plantsMedias AS PM 
INNER JOIN plants AS P ON(PM.idPlant = P.idPlant AND P.filed = 0 AND P.published = 1) 
GROUP BY P.idLanguaje, P.idVersion);

How can i get the “max(A.version)” if i must use only 1 operand?, if i understood good, inside IN i must have only “IN(SELECT AM.idMedia FROM….” to be correct.

Thanks in advice and sorry for my english, i try my best.

  • 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-17T10:04:40+00:00Added an answer on June 17, 2026 at 10:04 am

    JOIN the tables instead of these IN predicates:

    SELECT 
      ....
      A.version AVersion,
      P.Version PVersion
    FROM medias m
    INNER JOIN animalsMedias AS AM  ON m.idMedia = am.Id
    INNER JOIN plantsMedias  AS PM  ON m.idMedia = PM.ID
    LEFT JOIN
    (
      SELECT idAnimal, max(A.version) AS version 
      FROM animals
      WHERE A.filed = 0 
        AND A.published = 1     
      GROUP BY A.idLanguaje, A.idVersion 
    ) AS  A  ON AM.idAnimal = A.idAnimal 
    LEFT JOIN
    (
      SELECT idPlant, MAX(Version) version
      FROM Plants
      WHERE field = 0 AND published = 1
      GROUP BY P.idLanguaje, P.idVersion
    ) AS p ON PM.idPlant = P.idPlant;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to export some data from MySQL database. Problem is that I have
I need to export data from php (data retrieved from mysql database) to excel.
Hay guys, i need to export a MySQL database, but i only have access
I'm writing a small sqlalchemy shim to export data from a MySQL database with
Need some help from a MySQL expert here. I have a terrible database to
MYSQL Database: I have a table of data that I need to put into
I am trying to export data from my MySQL database to multiple CSV files
I'm trying to export data from a multivalue database (Unidata) into MySQL. Lets say
I need to export data from several tables in SQL Server 2008 using SSMS.
I need to export some data from SAS to CSV, so that I can

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.