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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:32:55+00:00 2026-06-10T20:32:55+00:00

I can get the results fine but each data-value results are comma seperated because

  • 0

I can get the results fine but each data-value results are comma seperated because it’s an array. I would like to make the query without any commas and maybe remove the last AND.

Is that possible ?

jQuery

//Submit Adv Search
    $('#submitAdvSearch').click(function(){
        var query = "SELECT * FROM table WHERE ";
        var yo = $('.subCat span[data-value].checked').map(function(){
            return $(this).attr('data-value')+'=1 AND ';
        }).get();

        console.log(query+' '+yo);
    });

HTML

<div class="cat">
    <div class="catTitle">
        <h2>Performance</h2>
        <span class="arrow"></span>
        <br class="clear"/>
    </div>
    <div class="subCat" data-cat="performance">
        <div>

                <span data-all="all">&#9675;&nbsp;Tous</span><br>
            <div class="after">
                <span data-value="30000_doublefrotements" class="checked">&#9675;&nbsp;+30,000 double frottement</span><br>
                <span data-value="atcc96_lavablecommercial">&#9675;&nbsp;ATTCC 96</span><br>
                <span data-value="nfpa701_inifuge">&#9675;&nbsp;NFPA 701</span><br>
                <span data-value="resistanrayonsuv">&#9675;&nbsp;Uv résistant</span>
            </div>
        </div>
    </div>
</div>

<div class="cat">
    <div class="catTitle">
        <h2>Style</h2>
        <span class="arrow"></span>
        <br class="clear"/>
    </div>
    <div class="subCat" data-cat="style">
        <div>

                <span data-all="all">&#9675;&nbsp;Tous</span><br>
            <div class="after">
                <span data-value="contemporain" class="checked">&#9675;&nbsp;Contemporain</span><br>
                <span data-value="traditionnel">&#9675;&nbsp;Traditionel</span><br>
                <span data-value="transitionnel" class="checked">&#9675;&nbsp;Transitionel</span>
            </div>
        </div>
    </div>
</div>
<div id="submitAdvSearch">Submit</div>

Result

SELECT * FROM table WHERE  30000_doublefrotements=1 AND ,contemporain=1 AND ,transitionnel=1 AND 
  • 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-10T20:32:56+00:00Added an answer on June 10, 2026 at 8:32 pm

    Use join(" AND ") to concatenate ANDs between each condition:

    var yo = $('.subCat span[data-value].checked').map(function() {
      return $(this).attr('data-value')+'=1';
    }).get();
    console.log(query + yo.join(" AND "));
    

    This will give you:

    SELECT * FROM table WHERE 30000_doublefrotements=1 AND contemporain=1 AND transitionnel=1

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

Sidebar

Related Questions

Googling has been difficult because I can't get results specific enough - wondering if
While using this code, i can't get any results... Ext.define('Teste.view.Main', { extend: 'Ext.Container', initialize:
How can I get Google search results from inside a program? I need to
couple of quick questions 1) In the local search results - we can get
i search online but can't get satisfactory result i want to protect images on
In my web application I would like to make a response-test process. This process
How can i get result My Dream Table Result CREATE TABLE #temp( [count] int
How can I get result from action? I need to show the commentID on
how can we get distinct result by using criteria in hibernate.
I have a problem, I can't get the result of my code. When I

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.