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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:14:30+00:00 2026-06-13T19:14:30+00:00

Each modx_site_content record may have several records in modx_site_tmplvar_contentvalues. I need to retrieve both

  • 0

Each modx_site_content record may have several records in modx_site_tmplvar_contentvalues.

I need to retrieve both modx_site_tmplvar_contentvalues.value where the tvv.tmplvarid = 3 AND the tvv.tmplvarid = 1. where tvv.tmplvarid is a future date, I need to return the tvv.value of tvv.tmplvarid 3 which is a comma separated list of tags.

This query does not return the values I need & I’m not sure how to get just what I want.

SELECT sc.id, sc.pagetitle, tvv.value, tvv.tmplvarid, tvv.id, tvv.value
FROM modx_site_content sc
left join modx_site_tmplvar_contentvalues tvv on tvv.contentid = sc.id
where published = '1' 
and (tvv.tmplvarid = '3' and tvv.value >= curdate())
order by sc.id;

basically in the end I need to return only the list of tags (tvv.tmplvarid = 3) where the other associated record (tvv.tmplvarid = 1) is a date in the future.

Any thoughts, can this be done with grouping instead? I don’t actually need anything from the modx_site_content table.

  • 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-13T19:14:31+00:00Added an answer on June 13, 2026 at 7:14 pm

    So you need to return the tags both rows in the modx_site_tmplvar_contentvalues table that has tmplvarid of 1 and 3 both related to the same modx_site_content, but only when the tmplvarid 3 row has a datetime field in the future?

    I would do two separate joins to the modx_site_tmplvar_contentvalues tabe:

    SELECT tOne.value, tThree.value
    FROM modx_site_tmplvar_contentvalues tOne
    INNER JOIN modx_site_content c ON tOne.contentid = c.id
    INNER JOIN modx_site_tmplvar_contentvalues tThree ON tThree.contentid = c.id
    WHERE c.published = 1
    AND tOne.tmplvarid = 1 
    AND tThree.tmplvarid = 3 AND tThree.date > NOW()
    

    SQL Fiddle: http://sqlfiddle.com/#!2/a4031/2

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

Sidebar

Related Questions

Each time I use Merge() I have the following: 'Cannot implicitly convert type 'void'
Each key in dictionary has list of MANY integers. I need to iterate through
Each client on the site has his own composition of HTML elements. Some may
Each camera folder has many thousands of photos, I need to open 20-or so
Each document of couchdb will have a new version after updating, and the previous
Each of my user's have a set number of slots for storage. They can
Each record has a started_at and completed_at datetime field. To calculate the time it
Each GPU device (AMD, NVidea, or any other) is split into several Compute Units
Each key in a hash has a value that's also a hash. { 100
Each time I have to copy paste || from elsewhere when I want to

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.