Is it possible to combine two meta items and concatenate them into a third?

Support General Is it possible to combine two meta items and concatenate them into a third?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1691
    jonwatson87jonwatson87
    Participant

    I'm trying to do a query based on TWO meta values which I need to combine in order to perform a comparison.

    Essentially, I'm trying to join a date and a time field to return the exact datetime that an event ends and compare it to the current datetime.

    Is such a thing possible? Can I combine a date meta and time meta in order to get a datetime meta? Or would it just be easier to remove the end time field, replace it with a datetime field and go back through my posts to change the data?

    #1704
    Anh TranAnh Tran
    Keymaster

    Hi,

    Sorry for this late reply. I think it's possible if you want to combine 2 values only when querying the database using raw MySQL query. But if you want to combine them in another way or somehow (I'm not sure what you want exactly), then maybe you need to write a custom script to check and re-add a new meta value for each post.

    #1727
    jonwatson87jonwatson87
    Participant

    Thanks, Ahn! I did have a look at doing it that way, but in the end it was quicker and easier just to go back and change all the date and time fields to combined datetime ones!

    Thanks for the suggestion, and for getting back to me! 🙂

    #1729
    Anh TranAnh Tran
    Keymaster

    Great that you have resolved this 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Is it possible to combine two meta items and concatenate them into a third?’ is closed to new replies.