All Questions

356
votes
6answers
649317 views

How can an 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 ano...
2771
votes
26answers
3071410 views

How do I UPDATE from a SELECT in SQL Server?

In SQL Server, it's possible to insert into a table using a SELECT statement: INSERT INTO Table (col1, col2, col3) SELECT col1, col2, col3 FROM other_table WHERE sql = 'cool' Is it also possible ...
370
votes
22answers
347317 views

MySQL select 10 random rows from 600K rows fast

How can I best write a query that selects 10 rows randomly from a total of 600k?
676
votes
20answers
1232879 views

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 li...
281
votes
28answers
240206 views

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)
321
votes
10answers
665258 views

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 w...
121
votes
31answers
395061 views

How to calculate age (in years) based on Date of Birth and getDate()

I have a table listing people along with their date of birth (currently a nvarchar(25)) How can I convert that to a date, and then calculate their age in years? My data looks as follows ID Name ...
41
votes
24answers
24358 views

quick selection of a random row from a large table in mysql

What is a fast way to select a random row from a large mysql table? I'm working in php, but I'm interested in any solution even if it's in another language.
335
votes
9answers
196280 views

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"> <op...
511
votes
9answers
1195634 views

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 refere...

Previous Next