Questions tagged [select]

Select is a common keyword used to query data. 'select()' is also a programming function for triggering code based on file handle or other system activity. Do not use this tag for questions related to: HTML

In query languages (SQL, …)

SELECT is a statement in query languages, like SQL or SPARQL. It returns a result set of records from one or more tables.

SELECT queries require two essential parts. The first part is the WHAT, which determines what we want SQL to go and fetch. The second part of any SELECT command is the FROM WHERE. It identifies where to fetch the data from, which may be from a SQL table, a SQL view, or some other SQL data object.

Reference


In HTML

<select> is also an HTML user interface element for choosing one or more option(s) from a finite collection of elements. Do not use this tag for this purpose, use instead.


In .NET/LINQ

select is a keyword that can be used for queries on various data sources that implement specific features, directly from language itself. Do not use this tag for such questions, use instead.


In C and C++

select() is an important system call used by C and C++ programs and libraries that avoids busy waiting for network activity and other I/O to complete.


In Perl

In Perl 5, select() has two different uses. When called with four parameters, it calls the same syscall as C and C++. In this form it has limited portability. Otherwise it is called with one or no parameters and sets or gets current default filehandle for output. The filehandle is used e.g. by print if no other specified. Special variables like $| relate to it, too. This second form is perfectly portable.

In Perl 6 it has been completely dropped.


In Go

The select statement lets a goroutine wait on multiple channel operations. A select blocks until one of its cases can run, then it executes that case.

38465 questions
6
votes
4 answers

Why does this select always run the default case when the first case actually is executed?

I'm trying to get a better understanding of golang channels. While reading this article I'm toying with non-blocking sends and have come up with the following code: package main import ( "fmt" "time" ) func main() { stuff := make(chan…
m90
  • 11,434
  • 13
  • 62
  • 112
6
votes
3 answers

Display value in select tag instead of text

I want to create a dropdown list, which should display value instead of text. But, when I click the dropdown, the option should display the text instead of value. I have added an example here, but it is not working as expected:
Raffel
  • 71
  • 1
  • 10
6
votes
2 answers

SQL Query similar to IN where clause with AND condition instead of OR

I am trying to optimize my SQL query, so that we will not have to process the response on our JVM. Consider we have following table with entries: +-----------+-------------+ | Column1 | Column2 | +-----------+-------------+ |val11 |val21 …
Krishna Kumar
  • 511
  • 1
  • 9
  • 21
6
votes
3 answers

Angular2 [selected] does not work to set up the default value?

I'm trying to set up default value for my selection so I tried [selected]= "selected_choice == 'one'" something like this but this didn't work. People said [selected] no longer works so I also tried [attr.selected] but didn't work as well.. this…
Lea
  • 1,245
  • 5
  • 22
  • 31
6
votes
1 answer

Limiting the displayed height of a select drop-down

I have a when opened?
Josh Smith
  • 14,674
  • 18
  • 72
  • 118
6
votes
3 answers

Incrementing Count within a Group By

I'm trying to get an incrementing counter within a set of results. For example, assume I have a messages table: messages -------- - id (int) - user_id (int) - sent_at (date) - body (text) I'd like to perform a query that gives me results like…
Tyler Reed
  • 442
  • 3
  • 15
6
votes
1 answer

How to extend Zend\Db\Sql\Select?

I am using MSSQL and want to implement the WITH function (as per Using ZF2, create a WITH statement?). To do so, I am extending the \Zend\Db\Sql\Select class adding the properties and methods required to add the WITH function. How do I now tell my…
Richard Parnaby-King
  • 14,703
  • 11
  • 69
  • 129
6
votes
4 answers

select() returns invalid argument

I am successfully reading from a pipe from another thread, and printing the output (in an ncurses window as it happens). I need to do this one character at a time, for various reasons, and I'm using a select() on the FD for the read end of the pipe,…
Robert
  • 6,412
  • 3
  • 24
  • 26
6
votes
3 answers

Can I do a mysql Select, Update and Delete in one query?

Can I say that one of many ways to optimize mysql is to reduce the number of queries? If that so, can I do this: - Select "data" => $A from table X - Update $A from table Y - Delete $A from table X in one query?
webdev_007
  • 121
  • 3
  • 5
  • 9
6
votes
5 answers

javascript onclick alert not working in chrome

"); $.each(data, function(i, v){ $("
sunn0
  • 2,918
  • 1
  • 24
  • 25
6
votes
5 answers

MySQL Query with multiple LIMITS

Let's say I have the following table with hundreds of toys of various colors... --------------------------- ITEM | COST | COLOR --------------------------- 1 | 12.00 | BLUE 2 | 10.98 | RED 3 | 9.34 | BLUE 4 | …
Alan M.
  • 1,309
  • 2
  • 19
  • 29
6
votes
1 answer

SELECT in a while loop in python with mysql

I am trying to find the latest entry in a MySQL database by using a query with SELECT MAX(id). I already get the latest id, so I know the query works, but now I want to use it in a while loop so I keep getting the latest entry with each…
EerlijkeDame
  • 477
  • 3
  • 8
  • 18
6
votes
6 answers

select distinct and one another column of the id

I have a table with multiple columns but I need only 2. select id, department from tbl If I want to use distinct, how do I do that? This is not working: select id, distinct department from tbl
Y.G.J
  • 1,098
  • 5
  • 19
  • 44
1 2 3
99
100