Search Results

Search found 12215 results on 489 pages for 'identity column'.

Page 59/489 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • MySQL Column Value Pivot

    - by manyxcxi
    I have a MySQL InnoDB table laid out like so: id (int), run_id (int), element_name (varchar), value (text), line_order, column_order `MyDB`.`MyTable` ( `id` bigint(20) NOT NULL, `run_id` int(11) NOT NULL, `element_name` varchar(255) NOT NULL, `value` text, `line_order` int(11) default NULL, `column_order` int(11) default NULL It is used to store data generated by a Java program that used to output this in CSV format, hence the line_order and column_order. Lets say I have 2 entries (according to the table description): 1,1,'ELEMENT 1','A',0,0 2,1,'ELEMENT 2','B',0,1 I want to pivot this data in a view for reporting so that it would look like more like the CSV would, where the output would look this: --------------------- |ELEMENT 1|ELEMENT 2| --------------------- | A | B | --------------------- The data coming in is extremely dynamic; it can be in any order, can be any of over 900 different elements, and the value could be anything. The Run ID ties them all together, and the line and column order basically let me know where the user wants that data to come back in order.

    Read the article

  • LaTeX: Automatic two-column wrapping of content

    - by plash
    Say I have a list of words that need to retain their order, and need to be sorted into two columns. I can do this rather well with a tabular: \begin{tabular}{l l} abc & def \\ ghi & jkl \\ \end{tabular} But doing so makes it rather difficult and time consuming to reorder the list. Is it possible to have an automatically wrapped two-column list? Ideally, I would like to simply enter an ordered list: \begin{magic} abc \\ def \\ ghi \\ jkl \\ \end{magic} And have it wrapped to two columns (as the tabular enables): abc def ghi jkl

    Read the article

  • Postgres column casting...

    - by Simon
    I have a query SELECT assetid, type_code, version, name, short_name, status, languages, charset, force_secure, created, created_userid, updated, updated_userid, published, published_userid, status_changed, status_changed_userid FROM sq_ast WHERE assetid = 7 which doesn't work and throws ERROR: operator does not exist: character varying = integer LINE 4: FROM sq_ast WHERE assetid = 7 I can get it to work by doing SELECT assetid, type_code, version, name, short_name, status, languages, charset, force_secure, created, created_userid, updated, updated_userid, published, published_userid, status_changed, status_changed_userid FROM sq_ast WHERE assetid = '7' Please note the quoting of the 7 in the WHERE clause... I am deploying an huge application and I cannot rewrite the core... similarly I don't want to risk changing the type of the column... I'm no Postgres expert... please help... Is there an option for strict casting of columns???

    Read the article

  • Index on column with only 2 distinct values

    - by Will
    I am wondering about the performance of this index: I have an "Invalid" varchar(1) column that has 2 values: NULL or 'Y' I have an index on (invalid), as well as (invalid, last_validated) Last_validated is a datetime (this is used for a unrelated SELECT query) I am flagging a small amount of items (1-5%) of rows in the table with this as 'to be deleted'. This is so when i DELETE FROM items WHERE invalid='Y' it does not perform a full table scan for the invalid items. A problem seems to be, the actual DELETE is quite slow now, possibly because all the indexes are being removed as they are deleted. Would a bitmap index provide better performance for this? or perhaps no index at all?

    Read the article

  • Querying a Single Column with LINQ

    - by Hossein Margani
    Hi Every one! I want to fetch array of values of a single column in a table, for example, I have a table named Customer(ID,Name), and want to fetch ids of all customers. my query in LINQ is: var ids = db.Customers.Select(c=>c.ID).ToList(); The answer of this query is correct, but I ran SQL Server Profiler, and saw the query which was like this: SELECT [t0].[ID], [t0].[Name] FROM [dbo].[Customer] AS [t0] I understood that LINQ selects all columns and then creates the integer array of ID fields. How can I write a LINQ query which generates this query in SQL Server: SELECT [t0].[ID] FROM [dbo].[Customer] AS [t0] Thank you.

    Read the article

  • MySQL Insert not working with Date column

    - by Ian McCullough
    Hello All, I am having an issue with a simple insert query into a table. I have this PHP Code $T_MEMBER = "INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('$memberID','$last','$first','$birthdate')"; mysql_query($T_MEMBER) or die(mysql_error()); Here are a few examples of what the query looks like if i echo it: INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('2007','Hayes','Karin','1958-30-10') INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('2020','Long','Peggy','1968-29-5') INSERT INTO T_MEMBER (MEMBER_IDENTIFIER,LAST_NAME,FIRST_NAME,BIRTH_DATE) VALUES ('2021','Torres','Diane','1968-30-8') BIRTH_DATE is a date type column. The problem is, after i do any of these queries, the date shows up as 000-00-00!!!! I have been wracking my brain and i cannot seem to find the issue. Thanks, Ian

    Read the article

  • Swap unique indexed column values in database.

    - by Ramesh Soni
    I have a database table and one of the fields (not primary key) is having unique index on it. Now I want to swap values under this column for two rows. How could this be done? Two hack I know are: Delete both rows and re-insert them Update rows with some other value and swap and then update to actual value. But I don't want to go for these as they do not seem to be the appropriate solution to the problem. Could anyone help me out?

    Read the article

  • Reversing column values in mysql command line

    - by user94154
    I have a table posts with the column published, which is either 0 (unpublished) or 1 (published). Say I want to make all the published posts into unpublished posts and all the unpublished posts into published posts. I know that running UPDATE posts SET published = 1 WHERE published = 0; UPDATE posts SET published = 0 WHERE published = 1; will end up turning all my posts into published posts. How can I run these queries in the mysql command line so that it truly "reverse" the values, as opposed to the mistake outlined above? Thanks

    Read the article

  • wpf style converter : "Convert" called by every datagrid column using it

    - by Sonic Soul
    I created a converter, and assigned it to a style. than i assigned that style, to the columns i want affected. as rows are added, and while stepping through debugger, i noticed that the converter convert method gets called 1 time per column (each time it is used). is there a way to optimize it better, so that it gets called only once and all columns using it get the same value? <Style x:Key="ConditionalColorStyle" TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource CellStyle}"> <Setter Property="Foreground"> <Setter.Value> <Binding> <Binding.Converter> <local:ConditionalColorConverter /> </Binding.Converter> </Binding> </Setter.Value> </Setter> </Style>

    Read the article

  • wrapping the content of a span inside an li so it stays in its own column

    - by codergeek
    hello, I have a list, each li in it has this structure: <li> <img class="yes" src="..."> <img class="no" src="..."> <span class="a">...</span> <span class="b">...</span> </li> now if the content of class b is long, it will wrap around the image. I don't want it to wrap under the image, I want it to stay in its own column. If there is anyway to do this, please let me know as using tables to do it will be just wrong. Thanks! Nima

    Read the article

  • Oracle - Updating one column or another based on a condition

    - by z-dan
    I want to update a record in a table but based on a condition I will either update one column or another but I do not want to have 2 separate statements because the statements are very long and detailed. Here is the basic idea with over simplification to get to the point. PROCEDURE Animal_something(p_updater VARCHAR2) begin if p_updater = 'person' then -- I want to update the modified_by else -- if p_updater = 'a process' I want to update modified_by_process Update table_creatures set animal_type = 'Dog , **modified_by** = 'Bob' **or do this** **modified_by_process =** 'creature_package' where animal_legs = '4' I don't want: if p_updater = 'person' then Update table_creatures set animal_type = 'Dog , modified_by = 'Bob' where animal_legs = '4'; else Update table_creatures set animal_type = 'Dog , modified_by_process = 'creature_package' where animal_legs = '4'; end;

    Read the article

  • How to select only the first rows for each unique value of a column

    - by nuit9
    Let's say I have a table of customer addresses: CName | AddressLine ------------------------------- John Smith | 123 Nowheresville Jane Doe | 456 Evergreen Terrace John Smith | 999 Somewhereelse Joe Bloggs | 1 Second Ave In the table, one customer like John Smith can have multiple addresses. I need the select query for this table to return only first row found where there are duplicates in 'CName'. For this table it should return all rows except the 3rd (or 1st - any of those two addresses are okay but only one can be returned). Is there a keyword I can add to the SELECT query to filter based on whether the server has already seen the column value before?

    Read the article

  • Convert row to column using sql server 2008?

    - by jaykanth
    Table name is Looupvalue id Ptypefield Value 1 1 D 2 1 E 3 1 F 4 1 G 5 1 H 6 2 FL 7 2 IF 8 2 VVS1 9 2 VVS2 10 2 VS1 11 2 VS2 12 3 0.50 13 3 1.00 14 3 1.50 15 3 2.00 16 4 Marquise 17 4 Round 18 4 Pear 19 4 Radiant 20 4 Princess Lookupvalue table value convert roow to column depends on ptypefield Like id 1 id 2 id 3 id 4 1 D 6 fl 12 0.50 16 Marquise 2 E 7 If 13 1 17 Round.... 3 F 8 vvs2 14 1.5 4 G 9 vvs2 15 2 5 H 10 vs1 11 vs2 Thanks

    Read the article

  • Grails multi column indexes

    - by Kimble
    Can someone explain how to define multi column indexes in Grails? The documentation is at best sparse. This for example does not seem to work at all: http://grails.org/GORM+Index+definitions I've had some luck with this, but the results seems random at best. Definitions that works in one domain class does not when applied to another (with different names of course). http://www.grails.org/doc/1.1/guide/single.html#5.5.2.6%20Database%20Indices Some working examples and explanations would be highly appreciated!

    Read the article

  • cfgrid boolean column as Yes/No

    - by Gene R
    I have a boolean type column in an html cfgrid. The data is stored in the database as 1/0 and is returned from CF as such. I want the user to see Yes/No instead of 1/0. I tried QuerySetCell, and couldn't get it to work. The form is editable, when you double click the cell, the checkboxes show and it updates as it should. The only issue is the display. <cfform> <cfgrid name="blah" format="html" bind="mycfccall" selectmode="edit"> <cfgridcolumn name="bitCol" header="Is it" width="75" type="boolean"> </cfgrid> </cfform> Thanks in advance...

    Read the article

  • datagrid column custom check mark

    - by Berryl
    I want a read only column bound to a boolean that shows a check mark image when true and nothing when false. The problem is the false value; I just want to show whatever the background of the datagrid is, but I don't see how to clear the image source. What should the Value of the image source be to do this? Cheers, Berryl <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Name="imgChecked" Source="\Img_Checkmark" /> <DataTemplate.Triggers> <DataTrigger Binding="{Binding IsPrimary}" Value="False"> <Setter TargetName="imgChecked" Property="Source" Value=""/> *** ??? *** </DataTrigger> </DataTemplate.Triggers> </DataTemplate> </DataGridTemplateColumn.CellTemplate>

    Read the article

  • MySQL: Column Contains Word From List of Words

    - by mellowsoon
    I have a list of words. Lets say they are 'Apple', 'Orange', and 'Pear'. I have rows in the database like this: ------------------------------------------------ |author_id | content | ------------------------------------------------ | 54 | I ate an apple for breakfast. | | 63 | Going to the store. | | 12 | Should I wear the orange shirt? | ------------------------------------------------ I'm looking for a query on an InnoDB table that will return the 1st and 3rd row, because the content column contains one or more words from my list. I know I could query the table once for each word in my list, and use LIKE and the % wildcard character, but I'm wondering if there is a single query method for such a thing?

    Read the article

  • How Pick a Column Value from a ListView Row - C#.NET

    - by peace
    How can i fetch the value 500 to a variable from the selected row? One solution would be to get the row position number and then the CustomerID position number. Can you please give a simple solution. SelectedItems means selected row and SubItems means the column values, so SelectedItem 0 and SubItem 0 would represent the value 500. Right? This is how i populate the listview: for (int i = 0; i < tempTable.Rows.Count; i++) { DataRow row = tempTable.Rows[i]; ListViewItem lvi = new ListViewItem(row["customerID"].ToString()); lvi.SubItems.Add(row["companyName"].ToString()); lvi.SubItems.Add(row["firstName"].ToString()); lvi.SubItems.Add(row["lastName"].ToString()); lstvRecordsCus.Items.Add(lvi); }

    Read the article

  • multi column sorting of datagrid view:

    - by Bi
    I have a datagridview in a windows form with 3 columns: Serial number, Name and Date-Time. The Name column will always have either of the two values: "name1" or "name2". I need to sort these columns such that the grid displays all the rows with name values in a specific order (first display all the "name1" rows and then all the "name2" rows). Within the "name1" rows, I want the rows to be sorted by the Date-Time. Please note programmatically, all the 3 columns are strings. For example, if I have the rows: 01 |Name1 | 2010-05-05 10:00 PM 02 |Name2 | 2010-05-02 08:00 AM 03 |Name2 | 2010-05-01 08:00 AM 04 |Name1 | 2010-05-01 11:00 AM 05 |Name1 | 2010-05-04 07:00 AM needs to be sorted as 04 |Name1 | 2010-05-01 11:00 AM 05 |Name1 | 2010-05-04 07:00 AM 01 |Name1 | 2010-05-05 10:00 PM 03 |Name2 | 2010-05-01 08:00 AM 02 |Name2 | 2010-05-02 08:00 AM I am not sure how to go about using the below: myGrid.Sort(.....,ListSortDirection.Ascending)

    Read the article

  • Adding a computed column to an ActiveRecord query

    - by bmwbzz
    Hi, I am running a query using a scope and some conditions. Something like this: conditions[:offset] = (options[:page].to_i - 1) * PAGE_SIZE unless options[:page].blank? conditions[:limit] = options[:limit] ||= PAGE_SIZE scope = Promo.enabled.active results = scope.all conditions I'd like to add a computed column to the query (at the point when I'm now calling scope.all). Something like this: (ACOS(least(1,COS(0.71106459055501)*COS(-1.2915436464758)*COS(RADIANS(addresses.lat))*COS(RADIANS(addresses.lng))+ COS(0.71106459055501)*SIN(-1.2915436464758)*COS(RADIANS(addresses.lat))*SIN(RADIANS(addresses.lng))+ SIN(0.71106459055501)*SIN(RADIANS(addresses.lat))))*3963.19) as accurate_distance Is there a way to do that without just using find_by_sql and rewriting the whole existing query? Thanks!

    Read the article

  • MS SQL Server 2008 Stored Procedure Result as Column Default Value

    - by user337501
    First of all, thank you guys. You always know how to direct me when I cant even find the words to explain what the heck im trying to do. The default values of the columns on a couple of my tables need to equal the result of some complicated calculations on other columns in other tables. My first thought is to simply have the column default value equal the result of a stored procedure. I would also have one or more of the parameters pulled from the columns in the calling table. I don't know the syntax of how to do it though, and any time the word "stored" and "procedure" land next to each other in google I'm flooded with info on Parameter default values and nothing relating to what I actually want. Half of that was more of a vent than a question...any ideas though? And plz plz dont say "Well, you could use an On-Insert Trigger to..."

    Read the article

  • setting codeigniter mysql datetime column to time() always sets it to 0

    - by Jake
    Hi guys. I'm using Codeigniter for a small project, and my model works correctly except for the dates. I have a column defined: created_at datetime not null and my model code includes in its array passed into db-insert: 'created_at' = time() This produces a datetime value of 0000-00-00 00:00:00. When I change it to: 'created_at' = "from_unixtime(" . time() . ")" it still produces the 0 datetime value. What am I doing wrong? How can I set this field to the given unix time? Also, I know mysql sets TIMESTAMP columns automatically for you - I'm not interested in that solution here. So far I can't find a complete example of this on the web.

    Read the article

  • Hiding/Unhiding Control in Gridview’s column - shifting problem

    - by lupital
    This is a follow up to my previous question: link text In gridview's column i have a linkbutton and a label under it. I want to hide/unhide label when linkbutton is clicked. I use javascript because i don't want any postbacks. The code: protected void gvwComments_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lButton = ((LinkButton)e.Row.Cells[2].FindControl("lbtnExpand")); Label label = ((Label)e.Row.Cells[2].FindControl("lblBody")); lButton.Attributes.Add("onclick", string.Format("HideLabel('{0}'); return false;", label.ClientID)); } } function HideLabel(button) { var rowObj = document.getElementById(button); if (rowObj.style.display == "none") { rowObj.style.display = "block"; } else { rowObj.style.display = "none"; } } The problem is that when I unhide the label by clicking on button, linkbutton is shifted a a bit upper it's original position in the cell. Is it possible to preserve linkbutton's position in the gridviews cell?

    Read the article

  • Add column from another table matching results from first MySQL query

    - by Nemi
    This is my query for available rooms in choosen period: SELECT rooms.room_id FROM rooms WHERE rooms.room_id NOT IN ( SELECT reservations.room_id FROM reservations WHERE ( reservations.arrivaldate >= $arrival_datetime AND reservations.departuredate <= $departure_datetime) OR ( reservations.arrivaldate <= $arrival_datetime AND reservations.departuredate >= $arrival_datetime ) OR ( reservations.arrivaldate <= $departure_datetime AND reservations.departuredate >= $departure_datetime ) ); How to add average room price column for selected period(from $arrival_datetime to $departure_datetime) from another table (room_prices_table), for every room_id returned from above query. So I need to look in columns whos name is same as room_id... room_prices_table: date room0001 room0002 room0003 ... Something like SELECT AVG(room0003) FROM room_prices_table WHERE datum IS BETWEEN $arrival_datetime AND $departure_datetime ??

    Read the article

  • Echoing a pseudo column value after a COUNT

    - by rob - not a robber
    Hi Gang... Please don't beat me if this is elementary. I searched and found disjointed stuff relating to pseudo columns. Nothing spot on about what I need. Anyway... I have a table with some rows. Each record has a unique ID, an ID that relates to another entity and finally a comment that relates to that last entity. So, I want to COUNT these rows to basically find what entity has the most comments. Instead of me explaining the query, I'll print it SELECT entity_id, COUNT(*) AS amount FROM comments GROUP BY entity_id ORDER BY amount DESC The query does just what I want, but I want to echo the values from that pseudo column, 'amount' Can it be done, or should I use another method like mysql_num_rows? Thank you!!!

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >