select

Getting single records back from joined tables that may produce multiple records

I've got a student table and an enrollment table; a student could have multiple enrollment records that can be active or inactive. I want to get a select that has a single student record and an indicator as to whether that student has active enrollments. I thought about doing this in an inline UDF that uses the student ID in a join to ...

Selecting rows with reference id's to same table from mysql

I have a table such as: id name ref_id order data_obj -- ---- ------ ----- -------- 1 Sam 0 15 [binary data] 2 Jack 0 20 [binary data] 3 Sue 0 25 [binary data] 4 Sam2 1 - [no data] 5 Sue2 3 - [no data] 6 Sam3 1 - [no data] The idea is that I ha...

A problem with Select's width in IE

I have three select boxes. <div style='float: left; padding-right: 10px;'> <select size="10" name="company_id"> // a lot of options here </select> </div> <div style='float: left; padding-right: 10px;'> <select size="10" name="department_id" id="department_id"> // a lot of options here </select> </div> <...

Select from multiple tables where one has distinct values

I have a simple problem here using SQL views. I just can't seem to figure it out at the moment. I have 2 tables, TableA and TableB. I want to retrieve FieldA in TableA and FieldB in TableB. The two tables are linked using an INNER JOIN. I only want rows where TableA.FieldA are distinct. The returned values should be of the top 10 items...

First jQuery plugin issues

Hey guys, first off let me just say Im a jQuery noob! I want to make a simple plugin that auto-populates a html select element, it works fine on the first element but when I call it again to populate a second it appends nothing. Here are my calls in the ajax tab where #product and #new-category are the select elements: $(function(){ ...

Get Latest Entry from Database

How can I get the latest entry by the latest DATE field from a MySQL database using PHP? The rows will not be in order of date, so I can't just take the first or last row. ...

Select only unique rows in mysql

I want to select only rows that are unique according to the column userid from a mysql table. So if I have two rows with the same userid none of them gets selected but if its only one it gets selected. I use the following code: SELECT T.id,T.name,T.userid FROM tbltest T WHERE userid NOT IN (SELECT userid FROM tbltest WHERE tbltest.id<>...

Select * from Table and still perform some function on a single named column

I'd like to be able to return all columns in a table or in the resulting table of a join and still be able to transform a date to a string by name. For example Select ID, DESCRIPTION, TO_CHAR(CHANGE_DATE,'YYYY-MM-DD HH24:MI:SS') AS FORMATED_DATE FROM MY_TABLE; This is all well and good for just these three columns. But, the table will...

help with T-SQL on SQL Server 2005

Hi there, I have a T-SQL that works below: SELECT WP_VTDID AS UTIL_VTDID, (SELECT COUNT(WP_ENGINE) FROM WAYPOINTS WHERE (WP_ENGINE = 1) AND (WP_SPEED > 0) AND WP_VTDID='L083') AS UTIL_RUN, (SELECT COUNT(WP_ENGINE) FROM WAYPOINTS WHERE (WP_ENGINE = 1) AND (WP_SPEED = 0) AND WP_VTDID='L083') AS UTIL_IDLE, (SELECT COUNT(WP_ENGINE) FROM ...

Is there an onSelect event or equivalent for HTML <select> ?

I have an input form that lets me select from multiple options, and do something when the user changes the selection. Eg, <select onChange="javascript:doSomething();"> <option>A</option> <option>B</option> <option>C</option> </select> Now, doSomething() only gets triggered when the selection changes. I want to trigger doSomethi...

More elegant solution for pulling value from DB using recordset

Is there a better solution (using less code) for the following code snippet. It is something that I find myself doing a lot of in VB6 and was hoping to trim it down. As I understand it Connection.Execute will not work SQL = "SELECT SomeID FROM TableA" RecordSet.Open SQL, Connection, adOpenStatic, adLockOptimistic, adCmdText ...

HTML SELECT - can you have multiple font colors in select field?

Hi Is it possible to have an HTML select field where the OPTION text is of different colors? <select> <option>Black_text (yellow_text)</option> </select> I tried using an CSS SPAN element to color the text but that doesn't seem to work. Any ideas? UPDATE: Note, I'm trying to have multiple font colors on the same OPTION row. I've se...

Selectable Table Row Jquery Asp.net

Hi all, I would like to create a table where the rows are selectable via jquery. I'd also like to pass certain table cell values from a double click event on a row to another page. Does any one have examples of how this would work? Thanks in advance ...

SQL/MySQL SELECT and average over certain values.

I have to work with an analysis tool that measures the Web Service calls to a server per hour. These measurments are inserted in a database. The following is a snippet of such a measurement: mysql> SELECT * FROM sample s LIMIT 4; +---------+------+-------+ | service | hour | calls | +---------+------+-------+ | WS04 | 04 ...

Stored Procedure Select as Argument

Is the following possible: EXEC sp_Edu3_DeleteTreeStructure (SELECT TreeStructureId FROM TreeStructures) The SP normally takes one argument. What I want is that the SP is executed for each TreeStructureId found by the Query. thx, Lieven Cardoen ...

ASP.NET 3.5.1 GridView in Update Panel requerying on row select?

Hi all, I have a GridView that is bound to an ObjectDataSource, and I am handling the full row select using the standard solution provdided all over of putting this line in the OnRowDataBound(): e.Row.Attributes["onclick"] = this.Page.ClientScript.GetPostBackEventReference(this, "Select$" + e.Row.RowIndex); All of this is working swi...

Informix: Select null problem

Using Informix, I've created a tempory table which I am trying to populate from a select statement. After this, I want to do an update, to populate more fields in the tempory table. So I'm doing something like; create temp table _results (group_ser int, item_ser int, restype char(4)); insert into _results (group_ser, item_ser) select ...

How can I tell a database to only return data in discrete portions?

I couldn't find a proper discussion thread on this topic, so I'm going to go ahead and ask here. Problem: I have a select query that returns a result of size 100,000+. The user wants to view all this data, but obviously I can't give it to him all at once. I also don't want to store so much data on the client's memory. I want the user to...

Select COUNT() from multiple databases in SQL

Hello, I am attempting to return the number of customers located in a specific state that have rented a specific movie, where the rents table contains two columns, one for customer ID and one for the movie ID. The function takes in a movie ID and the state and returns an integer with the amount of customers. Right now I have an implemen...

Vim replace selected text

Lets say we have a a text and i enter in visual mode and select a text and how do i quickly do a search for the highlight text and replace it with something else thanks ...