select

Concatenate a selected column in a single query?

I know you can do this, because I've seen it done once before, but I forget where and up until now I haven't need to do it. I have a table called Employees, and it has various employee data (duh). I need a query that will do a select on the first and last name of all rows in the table, and then contenate all of them into a comma delimit...

How can I optimize this query?

How can I optimize this query? It seems there should be a much easier way to do this. The goal is that it will still be able to be readily turned into a delete statement. SELECT * FROM team WHERE team_id IN ( SELECT team_id FROM ( SELECT team.team_id, ( ...

SQL SELECT: combining and grouping data between three tables using subqueries

Sorry for a long question and not a very descriptive title, but my problem is very difficult to explain briefly. I have three database tables: TABLE A: AID PK STATUS VARCHAR TABLE B: BID PK AID FK CID FK TABLE C: CID PK CREATIONTIME DATE For each STATUS = 'OK' row in table A I want to find the corresponding row in C w...

Insert similar data into two tables

Hello all.. I have the following code I use to insert form data into a single table in my db.` function insert_interests($uid, $interests) { /* first, we'll delete any entries this user already has in the table */ purge_lookup("jss_users_interests_table", $uid); /* now create the sql insert query */ global $db; $db->query(create_chec...

Select average value and distinct values SQL

I have a table of locations with latitude, longitude and the U.S. state fields. I would like to select the average latitude and longitude for each state. I am trying the following code but I get a syntax error on distinct. select avg(lat), avg(lon), distinct(state) from tRealtyTrac order by state group by state ...

Using Select Statement from 1 database to insert into another database using VB .NET

Hi, I am currently writing a VB .NET application where I am trying to open 1 database, create a select statement and then post the results into another database file using Microsoft Access database 2003. The code seems to stop executing at the statement cmdJetDB.ExecuteNonQuery() I am using the following code: Dim conn1 As OleDbConne...

loading input from multi choice

Hi I have a task as that a dropdown list to choose an input type selections are textbox datetime number while choosing one of those types, I have to open the selected input(for example if user chose datetime I have to open a datetime input) For this task which is most suitable using aspview(each input type one view) for each ...

jQuery: Best practice to populate drop down?

The example I see posted all of the time seems like it's suboptimal, because it involves concatenating strings, which seems so not jQuery. It usually looks like this: $.getJSON("/Admin/GetFolderList/", function(result) { for (var i = 0; i < result.length; i++) { options += '<option value="' + result[i].ImageFolderID + '">' + re...

How can I write a SQL select statement to include a lookup from another table?

I'm copying data from one database to another and massaging the data while I'm at it. Both databases have tables called Clients and Jobs. However, in database "Alpha" the Jobs table does not have a relationship to the Clients table, where database "Epsilon" does. Alpha's Jobs table just has the Clients name in an nvarchar column. I...

how to reload my select element of html from database in java

Actually wat I need is: I have submitted some data in database from a html form. Then I have to load one column of that data in select tag of another form. I have done this but problem is that how will I increase the number of options as the number of records are increased. Code is as follows <%@ page import="java.util.*"%> <%@ page ...

How can I make form.select return a model in Rails?

I have a model called Contact which has_one guest like so. class Contact < ActiveRecord::Base has_one :guest, :class_name => "Contact", :foreign_key => "guest" end In my create view I'm using the select helper method to list all Contacts that can be chosen as a guest like so... <% form_for(@contact) do |f| %> <%= f.error_messages...

Select Something + An arbitrary Number in Mysql

I have a situation where I need to do something like select 2, id from users; I think that would work at least with Oracle but it doesn't work in Mysql. Any ideas? ...

WiX wxs script with option to install on Selecting current-user or all-users install

I need a complete WiX script that can be build.It had Welcome EULA Install Folder Selecting current-user or all-users install Install Finish I hope I'm not asking for too much,I just need a single wxs file cause its for a simple application,also I need an option to install it for the current user or all user,I haven't been able to ...

Programmatically selecting Items/Indexes in a ListBox

In WPF, I'd like to set the selected indexes of a System.Windows.Controls.ListBox I best way I've found so far is to remove all the items from the control, insert the selected, call SelectAll(), then insert the rest, but this solution neither works in my situation nor is very efficient. So, how do you set items in a Listbox to be selec...

Optimize SQL Stored Procedure

A stored procedure that runs a SELECT on a large table is timing out. The where clause is causing the timeout, because I am selecting only cities that are in another table. AND city IN (SELECT DISTINCT city from tOH where clientId = @clientId) AND state IN (SELECT DISTINCT state from tOH where clientId = @clientId) *note almost alway...

What is an alernative for the form select for full versatility in Internet Explorer?

I know Internet Explorer has always been hopeless with styling html <select> with inconsistent or non-existent font sizes, colours, borders, background colours etc so what are some alternatives for creating your own flexible field that is cross-browser compatible? It's fine to require any JavaScript framework such as jQuery etc. I'm thi...

MySql : Select statement using IN operator

Hi, I have a table with several fields and one field having 3 Comma Separated Values Column 1 Column 2 1 1,2,3 2 2,3,4 3 6,7,8 Now i want to run an SQL query which fetches me the rows which have the value i send as an input. Like in the above example, if i send a value 2 as an input to the function...

Multiple select option rtl alignment problem

I have a multiple select element when i tried to aligned the options to the right i can't , and i searched the web for many articles but i failed to find the solution at last ...

Mysql: How to query a column whose type is bit?

Hi I am using hibernate and Mysql. I have a class with a boolean attribute called 'active'. The generated database table has the BIT data type. So far so good. I want to query this value but I don't know how to do it. I've tried SELECT * from table where active = 1 doesn't work, neither the following SELECT * from table where act...

How to select a row in table using jquery?

I have created a table in my application, I want to select (change background color) whole row on click of a checkbox, same as gmail is doing, When we click checkbox in gmail, the whole row becomes yellow. <table> <tbody> <tr> <td><input type="checkbox" name="chk" id="chk" /></td> <td>My Name</td> <td>Description of the job</td> </tr> <...