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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:29:26+00:00 2026-06-11T06:29:26+00:00

if the data in table is : select * from data; key | value

  • 0

if the data in table is :

select * from data;

 key  | value                    
------+---------
 a    | a_value
 b    | b_value
 c    | c_value
 d    | d_value
 e    | e_value
 f    | f_value

if one client connects to my web server and ask for the value of a, my application will try to do:

select value where key = 'c';

and send the result value to client

if 3 clients connect to my web server, there are 3 statements occur,

  select value where key = 'e';  # client 1

  select value where key = 'c';  # client 2

  select value where key = 'a';  # client 3

for resource reason, I want to consolidate many statements into one select statement.

select * where key = 'e' or key = 'c' or key = 'a';

 key  | value                    
------+---------
 a    | a_value
 c    | c_value
 e    | e_value

but the problem is the sequence of result is not the same as my WHERE clause.
so I cannot distinguish the result from the clients’ query.
if I want to send value back to the clients

'e_value' to client 1
'c_value' to client 2
'a_value' to client 3

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-06-11T06:29:28+00:00Added an answer on June 11, 2026 at 6:29 am

    I don’t quite understand your use-case, but a query like the following enables you to

    1. .. get results in pre-defined order
    2. .. identify rows in result set
    SELECT v.*, d.value
    FROM   data
    JOIN  (
       VALUES
         (1::int, 'e'::text)  -- explicit cast may not be necessary
        ,(2, 'c')
        ,(3, 'a')
        ) v(client, key) USING (key)
    ORDER  BY v.client;
    

    Returns:

    client | key | value
    -------+-----+------
    1      | e   | e_value
    2      | c   | c_value
    3      | a   | a_value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to select data from one table and insert it into another table.
I like to have a query like this: select data from table where (x
'Names' in table 'Data' type12pen105A type12pen110A type12pen121B Declare @n int; select Names From Data
I'm try display data from column points , SELECT * from table ORDER by
I try to select data from database table with many conditional clauses where my
I'm currently trying to copy data from table into another by using a SELECT
I select data from several tables. Then i need to edit the data returned
I need to select data from 2 tables in my DB - comments and
I am trying to select data from two tables and insert it into another
how to select all the data from many tables? i try `SELECT * FROM

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.