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 <select> tag (use [html-select]); language integrated query such as LINQ or similar, etc.

Filter by
Sorted by
Tagged with
4054votes
37answers
4.9mviews

How do I UPDATE from a SELECT in SQL Server?

In SQL Server, it is possible to insert rows into a table with an INSERT.. SELECT statement: INSERT INTO Table (col1, col2, col3) SELECT col1, col2, col3 FROM other_table WHERE sql = 'cool' Is it ...
user avatar
  • 42.7k
1532votes
21answers
3.3mviews

Selecting multiple columns in a Pandas dataframe

I have data in different columns, but I don't know how to extract it to save it in another variable. index a b c 1 2 3 4 2 3 4 5 How do I select 'a', 'b' and save it in to df1? ...
user avatar
  • 20.4k
1093votes
27answers
2.2mviews

SQL update from one Table to another based on a ID match

I have a database with account numbers and card numbers. I match these to a file to update any card numbers to the account number, so that I am only working with account numbers. I created a view ...
user avatar
925votes
18answers
2.5mviews

jQuery get value of select onChange

I was under the impression that I could get the value of a select input by doing this $(this).val(); and applying the onchange parameter to the select field. It would appear it only works if I ...
user avatar
  • 18.6k
816votes
15answers
3.1mviews

SQL SELECT WHERE field contains words

I need a select which would return results like this: SELECT * FROM MyTable WHERE Column1 CONTAINS 'word1 word2 word3' And I need all results, i.e. this includes strings with 'word2 word3 word1' or '...
user avatar
  • 12.1k
619votes
13answers
1.3mviews

MySQL - UPDATE query based on SELECT Query

I need to check (from the same table) if there is an association between two events based on date-time. One set of data will contain the ending date-time of certain events and the other set of data ...
user avatar
  • 13.5k
600votes
28answers
817kviews

How to make the first option of <select> selected with jQuery

How do I make the first option of selected with jQuery? <select id="target"> <option value="1">...</option> <option value="2">...</option> </select>
user avatar
  • 129k
538votes
6answers
765kviews

Create a temporary table in a SELECT statement without a separate CREATE TABLE

Is it possible to create a temporary (session only) table from a select statement without using a create table statement and specifying each column type? I know derived tables are capable of this, but ...
user avatar
  • 80.6k
476votes
19answers
719kviews

Select columns from result set of stored procedure

I have a stored procedure that returns 80 columns, and 300 rows. I want to write a select that gets 2 of those columns. Something like SELECT col1, col2 FROM EXEC MyStoredProc 'param1', 'param2' ...
user avatar
  • 5,730
459votes
6answers
908kviews

SQL query return data from multiple tables

I would like to know the following: how to get data from multiple tables in my database? what types of methods are there to do this? what are joins and unions and how are they different from one ...
436votes
18answers
988kviews

SQL/mysql - Select distinct/UNIQUE but return all columns?

SELECT DISTINCT field1, field2, field3, ...... FROM table I am trying to accomplish the following sql statement but I want it to return all columns is this possible? Something like: SELECT ...
user avatar
  • 72.8k
426votes
33answers
415kviews

Select all columns except one in MySQL?

I'm trying to use a select statement to get all of the columns from a certain MySQL table except one. Is there a simple way to do this? EDIT: There are 53 columns in this table (NOT MY DESIGN)
user avatar
397votes
13answers
314kviews

SQL join: selecting the last records in a one-to-many relationship

Suppose I have a table of customers and a table of purchases. Each purchase belongs to one customer. I want to get a list of all customers along with their last purchase in one SELECT statement. What ...
user avatar
  • 6,907
393votes
9answers
262kviews

Why does the jquery change event not trigger when I set the value of a select using val()?

The logic in the change() event handler is not being run when the value is set by val(), but it does run when user selects a value with their mouse. Why is this? <select id="single"> <...
user avatar
  • 10.4k
380votes
6answers
1.4mviews

Convert INT to VARCHAR SQL

I am using Sybase and I am doing a select which returns me a column called "iftype", but its type is int and I need to convert into varchar. When I try to do the select without the convert function I ...
user avatar
  • 4,263

15 30 50 per page
1
2 3 4 5
2551