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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:02:29+00:00 2026-05-17T20:02:29+00:00

I was using MySQL’s concat_ws function to get data from MySQL database and it

  • 0

I was using MySQL’s concat_ws function to get data from MySQL database and it was working perfectly. I discover this query through this SO Question. Now I have same case but this time database is SQL Server.

Asking again for SQL Server:

I have a table like this:

id | roll_no | name
---------------------
 1 |   111   | Naveed
 2 |   222   | Adil
 3 |   333   | Ali 

If I have data like this:

$fields = array( "id" , "roll_no" ) and $values = array( "1,111", "2,222" );

It means I have to write a sql query to get records from table where (id != 1 and roll_no != 111) and (id != 2 and roll_no != 222). It means 3rd record will be fetched.

I have data like this:

$fields = array( "id" ) and $values = array( "2", "3" );

It means I have to write a sql query to get records from table where (id != 2) and (id != 3). It means 1st record will be fetched.

How to write a general single query to get data from table using above two data arrays?

Thanks

  • 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-05-17T20:02:30+00:00Added an answer on May 17, 2026 at 8:02 pm

    Your question is unclear for me, but from the link you provided to the other SO question, and assuming you just want to adapt to SQL Server, I guess you could just replace

    concat_ws (',', id, roll_no)
    

    by

    id + ',' + roll_no
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Using MySQL 4.1.22) I can't get this query of mine to use an index
When using mysql_fetch_object() to return objects from a MySQL query, sometimes column names have
I am using MySQL database. When I execute a query which the main table(20
Using MySQL , I can do something like: SELECT hobbies FROM peoples_hobbies WHERE person_id
Using MySQL syntax, how would I write a query to return the following (I
I am using MySQL and PHP for a project I am working. I have
I've developed an application at working using MySQL 5, that uses Views to access
I'm building a wepage in php using MySQL as my database. Which way is
Using MySQL 5 I have a table like this: date (varchar) door (varchar) shift
Using mysql directly from the command line (running on Ubuntu 9.10, standard bash terminal),

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.