select

How to select an element by Class instead of ID in ASP.NET?

I have a few scattered <p> elements on the aspx page which I am grouping together using a class like so - <p class="instructions" runat="server"> In my code behind, using C# I want to hide these elements, using something like instructions.Visible = false; However I realize I can only do this in codebehind if I use ID but this will res...

MySQL SELECT, store in a variable

For a stored procedure, I want to do a SELECT, and store a column's value into a variable. How do I do this? I want to do something like this: DECLARE countTemp INT; SET countTemp=(SELECT COUNT(Name) FROM mytable WHERE Name= var_name LIMIT 0,1); OR, like this : DECLARE countTemp INT; SELECT countTemp=ColumnXYZ FROM ...

SQL SELECT Statement

I have a table with the following columns: id, teamA_id, teamB_id Will it be possible to write a SELECT statement that gives both teamA_id and teamB_id in the same column? EDIT: Consider this example From id, teamA_id, teamB_id 1, 21, 45 2, 34, 67 I need Teams 21 45 34 67 ...

MySQL SELECT Statment to return 2 coloumns into 1

Hi, I have a table with the following columns id, teamA_id, teamB_id Will it be possible to do a MYSQL SELECT statement that gives both teamA_id and teamB_id in the same column? EDIT Consider this example From id, teamA_id, teamB_id 1, 21, 45 2, 34, 67 I need Teams 21 45 34 67 ...

Selected option in view when SIZE is greater than 1

How do you get the selected option to be in view on page load? <select name="whatever" size="5"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7" selected>7</opti...

MySQL - Select the last inserted row easiest way

Hi, I would need simply select the last entered row specified by condition,e.g: SELECT ID from bugs WHERE user=Me I need to return only the very last ID entered by user 'Me'. Is there any simple way? Thank you ...

Codeigniter: Select from multiple tables

How can I select rows from two or more tables? I'm setting default fields for a form, and I need values from two tables... My current code reads: $this->CI->db->select('*'); $this->CI->db->from('user_profiles'); $this->CI->db->where('user_id' , $id); $user = $this->CI->db->get(); $user = $user->row_array(); $th...

SQL select statement from 2 tables

Hi, I have a small sql question. I have 2 tables Members and Managers Members has: memberID, Name, Address Managers has: memberID, EditRights, DeleteRights EditRights and DeleteRights are of type bit. Mangers have a relationship with Members, because they are members themselves. I want to select all members id's, name and adress a...

html select execute javascript onload

I am using HTML select onchange event to fire another javascript function func1. This html select is written into a form element, which are dynamically generated when users click on a button. The problem is how can I fire the javascript func1 when the dynamically generated form is first shown ? I am thinking of something along the line...

MySQL Select distinct values across multiple tables..

I have two tables: table_1 uid | xid | name table_2 uid | elements | time | pkey I want to select multiple rows of xid, elements and time where time is the 10 smallest values and uid (or xid) is distinct. uid, xid in in table_1 is unique and the relationship between uid in table_1 and table_2 is one to many.. I tried something like...

Linux C select: piping echo to input works, but reading from keyboard doesn't?

Hi all, I am trying to understand http://beej.us/guide/bgnet/examples/select.c (included below for reference). I am doing this: :~$ cat /etc/issue Ubuntu 10.04 LTS \n \l :~$ gcc --version gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 :~$ wget http://beej.us/guide/bgnet/examples/select.c :~$ gcc select.c -o select :~$ echo "ff" | ./select...

From comma separated list to individual item result set. *mysql

I'm doing some data migration from a horribly designed database to a less horribly designed database. There is a many to many relationship that has a primary key in one table that corresponds to a comma separated list in another. FK_ID | data ------------- 1,2 | foo 3 | bar 1,3,2 | blarg Is there a way to output the FK_ID field ...

Insert into Table from #tempTable fails

I am simply taking the data from a Table and insert it into #tempTable then delete the data, and insert it back to the table. I get "Insert Error: Column name or number of supplied values does not match table definition." Error. Here are the lines I am running. SELECT * INTO #tempTable FROM dbo.ProductSales SELECT * FROM #tempTable ...

Is it possible a trigger on a select statement with MySQL?

Hi. I know that triggers can be used on insert, update and delete, but what about a trigger (or sort of) on a select statement. I want to use a trigger to insert data on a table B when it is selected an existent record on a table A, it could be possible?. Thanks in advance. ...

MYSQL Select Statment with Modification to tuple values

Hi, I have the following table: bar_id, bar_name, subscription_id_fk, sub_name eg: 1, Hard Rock, 2, Gold 2, TGIF, 1, Free Now I need and SQL to extract this table, but where sub_name = Gold, I need to double the subscription_id_fk. Can you please help ? Edit: I need this value to be only changed in the result of the SQL statment...

MYSQL JOIN SELECT Statment - omit duplicated

Hi, I am tying to join the following 2 queries but I am having duplicated .... it is possible to remove duplacted fro this: ( SELECT bar_id, bar_name, town_name, bar_telephone, (subscription_type_id *2) AS subscription_type_id FROM bar, sportactivitybar, towns, subscriptiontype WHERE sport_activity_id_fk =14 AND bar_id = b...

HTML: how to set background color of item in select element

how do you set the background color of an item in an HTML select list? ...

Why does this SELECT ... JOIN statement return no results?

I have two tables: 1. tableA is a list of records with many columns. There is a timestamp column called "created" 2. tableB is used to track users in my application that have locked a record in tableA for review. It consists of four columns: id, user_id, record_id, and another timestamp collumn. I'm trying to select up to 10 reco...

how to get option title="sample" using jquery

Hi, I'm trying to update a hidden field based on the a title attribute on a select option, I've tried the code bellow and can't seem to get it to work. Thanks for any help! <form> <select id="selectbox"> <option name="test" value="one" title="title" selected="selected">one</option> <option name="test2" value="two" title="title2">two</op...

MYSQL extract day number from day

Is it possible to extertract and integer value from "Mon", Tue", "Wed" etc with an SQL statment? For example Mon = 1 Tue = 2 Wed = 3 etcv ...