Search Results

Search found 7127 results on 286 pages for 'calculated columns'.

Page 24/286 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • MYSQL Convert rows to columns performance problem

    - by Tarski
    I am doing a query that converts rows to columns similar to this post but have encountered a performance problem. Here is the query:- SELECT Info.Customer, Answers.Answer, Answers.AnswerDescription, Details.Code1, Details.Code2, Details.Code3 FROM Info LEFT OUTER JOIN Answers ON Info.AnswerID = Answers.AnswerID LEFT OUTER JOIN (SELECT ReferenceNo, MAX(CASE DetailsIndicator WHEN 'cde1' THEN DetailsCode ELSE NULL END ) Code1, MAX(CASE DetailsIndicator WHEN 'cde2' THEN DetailsCode ELSE NULL END ) Code2, MAX(CASE DetailsIndicator WHEN 'cde3' THEN DetailsCode ELSE NULL END ) Code3 FROM DetailsData GROUP BY ReferenceNo) Details ON Info.ReferenceNo = Details.ReferenceNo There are less than 300 rows returned, but the Details table is about 180 thousand rows. The query takes 45 seconds to run and needs to take only a few seconds. When I type show processlist; into MYSQL it is hanging on "Sending Data". Any thoughts as to what the performance problem might be?

    Read the article

  • NHibernate and SetSessionAuth audit columns

    - by user86431
    We have audit columns set by triggers. For obscure security reasons predating my tenure and out of my control, we log in with a generic user, and do a 'set session authorization' to change the user to the db user of the user who is logged in. When we converted to NHibernate, it creates a whole new session and jacks everything up when we try to do a set session auth, so we turned the set session auth off... Now we are trying to find out a way to get NHibernate to let us do 'set session authorization' without recycling the session on us, so we can use our existing trigger based audit column stuff with both legacy apps, and our new NHibernate apps. It's not a ideal soloution, or the best way to do it even, but is it possible? I was hoping there was a alternate interface that allowed this kind of access. Does anyone know how to do it, or can you point me towards and good hints? Thanks, Eric-

    Read the article

  • Recursive query question - break rows into columns?

    - by Stew
    I have a table "Families", like so FamilyID PersonID Relationship ----------------------------------------------- F001 P001 Son F001 P002 Daughter F001 P003 Father F001 P004 Mother F002 P005 Daughter F002 P006 Mother F003 P007 Son F003 P008 Mother and I need output like FamilyID PersonID Father Mother ------------------------------------------------- F001 P001 P003 P004 F001 P002 P003 P004 F001 P003 F001 P004 F002 P005 P006 F002 P006 F003 P007 P008 F003 P008 In which the PersonID of the Father and Mother for a given PersonID are listed (if applicable) in separate columns. I know this must be a relatively trivial query to write (and therefore to find instructions for), but I can't seem to come up with the right search terms. Searching "SQL recursive queries" has gotten me closest, but I can't quite translate those methods to what I'm trying to do here. I'm trying to learn, so multiple methods are welcome, as is vocabulary I should read up on. Thanks!

    Read the article

  • Cluster analysis on two columns that contain name of person in R

    - by Alka Shah
    I am a beginner in R. I have to do cluster analysis in data that contains two columns with name of persons. I converted it in data frame but it is character type. To use dist() function the data frame must be numeric. example of my data: Interviewed.Type interviewed.Relation.Type 1. An1 Xuan 2. An2 The 3. An3 Ngoc 4. Bui Thi 5. ANT feed 7. Bach Thi 8. Gian1 Thi 9. Lan5 Thi . . . 1100. Xung Van I will be grateful for your help.

    Read the article

  • Variable width columns in a table

    - by Jack
    I'm using an HTML table for a calendar and I want to fill the cells with various events from my database. Usually they will land on weekends but some will run for long weekend, bank holidays or even the odd week day. How can I get my tables columns to expand and shrink accordingly. I'd like to avoid the use of javascript if possible. If this can't be done I'm going to need a tutorial to help me get my head around how to make div's positioning behave. cheers

    Read the article

  • .net MVC 3 multiple columns

    - by Teodor
    i want to display a list in more columns with 5 items/column my code now doesn't work as expected: @{ var c=0; } <div > @foreach (var item in Model) { c += 1; @Html.ActionLink(item.Judet , "Browse", new { judet = item.Judet }) <br /> if (c == 5){ Response.Write("</div><div style='border: 1px solid red;'>"); c = 0; } } </div>

    Read the article

  • Adding custom columns to Propel model?

    - by Hard-Boiled Wonderland
    At the moment I am using the below query: $claims = ClaimQuery::create('c') ->leftJoinUser() ->withColumn('CONCAT(User.Firstname, " ", User.Lastname)', 'name') ->withColumn('User.Email', 'email') ->filterByArray($conditions) ->paginate($page = $page, $maxPerPage = $top); However I then want to add columns manually, so I thought this would simply work: foreach($claims as &$claim){ $claim->actions = array('edit' => array( 'url' => $this->get('router')->generate('hera_claims_edit'), 'text' => 'Edit' ) ); } return array('claims' => $claims, 'count' => count($claims)); However when the data is returned Propel or Symfony2 seems to be stripping the custom data when it gets converted to JSON along with all of the superflous model data. What is the correct way of manually adding data this way?

    Read the article

  • Select columns from join table only without requiring a join

    - by Kent Boogaart
    Given these tables: create table Orders ( Id INT IDENTITY NOT NULL, primary key (Id) ) create table Items ( Id INT IDENTITY NOT NULL, primary key (Id) ) create table OrdersItems ( OrderId INT not null, ItemId INT not null, primary key (OrderId, ItemId) ) Is it possible to use HQL/criteria API to contruct a query that results in the following SQL: SELECT [OrderId], [ItemId] FROM [OrdersItems] I've tried both of these approaches: var hqlResults = session .CreateQuery("select order.id, item.id from Order order inner join order.Items item") .List(); var criteriaResults = session .CreateCriteria<Order>() .CreateAlias("Items", "item", NHibernate.SqlCommand.JoinType.None) .SetProjection(Projections.Property("id"), Projections.Property("item.id")) .List(); But both approaches insist on generating a join (or fail because the join isn't present, in using criteria), resulting in SQL such as: select order.Id, item.Id from Orders order inner join OrdersItems ordersItems on order.Id = ordersItems.ArticleId inner join Items item on ordersItems.CategoryId = item.Id Is there any way to have NHibernate generate a query that selects columns only from the join table, without requiring a join?

    Read the article

  • Using LINQ to Obtain Max of Columns for Two Dimensional Arrays

    - by Ngu Soon Hui
    Is there anyway to use LINQ to obtain the maximum of each columns for two dimensional arrays? Assume that I have the following: var arrays = new double[5,100](); I want to get the maximum of arrays[0,:], arrays[1,:] .... arrays[4,:]. How to use LINQ to do it? I could have use such method public double GetMax(double[,] arr, int rowIndex) { var colCount = arr.GetLength(1); double max = 0.0; for(int i=0; i<colCount; i++) { max=Math.Max(Math.Abs(arr[rowIndex, i]), max); } return max; } But I would prefer a more succinct ways of doing things.

    Read the article

  • Center four columns in CSS

    - by Ernest
    Hi everybody, I'm trying to make four columns that are centered on the frontpage. I would like it to look like this example: http://www.clutterpad.com/ My code looks like this: #bottom-container {width:100%;height:250px;position:relative;} #bottom-mid {background-color:white;} #bottom-left, #bottom-mid, #bottom-right {height:250px;} #bottom-left, #bottom-right {width:50%;float:left;} #bottom-left {background-color:white;position:absolute;top:0px;left:0px;} #bottom-right {background-color:white;position:absolute;top:0px;left:50%;} #bottom-mid {position:relative;margin:0px auto; width:1000px;z-index:2;} #column-container {width:100%; margin:20px auto;} .column {width:200px;float:left;font-size:10pt;font-family:Arial;margin:20px 10px;} But it's not working out. How should I code it to look like the example I mentioned before?

    Read the article

  • Float multiple fixed-width / varible-height boxes into 2 columns

    - by Jeremy H
    I'll try to explain this as best I can. I have multiple divs that are fixed-width but variable height. I want to float these boxes into two columns inside a fixed-width container. What happens when a give them all a float: left value, I get something like this: ######### ######### # box 1 # # box 2 # ######### # ..... # ......... # ..... # ......... ######### ######### ######### # box 3 # # box 4 # # ..... # # ..... # ######### ######### ######### ######### # box 5 # # box 6 # # ..... # ######### # ..... # ######### (The periods are white space) What I really would really like is the top of box 3 to touch the bottom of box 1. Any easy way to acheive this?

    Read the article

  • Sorting tab delimited text file based on multiple columns in natural way [duplicate]

    - by Vignesh
    This question already has an answer here: Sorting a column of CSV file resulting in 1123 appearing before 232 1 answer I am trying to sort a file based on all two columns Eg: chr19 1070019 1070020 chr16 869712 869713 chr1 1378131 1378132 chr12 189386 189387 chr4 254941 254942 chr16 1476500 1476501 chr2 1476810 1476811 chr19 313283 313284 chr17 595817 595818 chr18 656897 656898 chr19 1061829 1061830 I Tried sort -t $\t -k1,1 2,2 <filename> but doesn't work. I want the output to be sorted by first column and second column based on first column. I want to do a natural sort. Not lexical sorting. Eg: chr1 1378131 1378132 chr2 1476810 1476811 chr4 254941 254942 chr12 189386 189387 chr16 869712 869713 chr16 1476500 1476501 chr17 595817 595818 chr18 656897 656898 chr19 313283 313284 chr19 1061829 1061830 chr19 1070019 1070020 Anyone any idea?

    Read the article

  • How to add columns to sqlite3 python?

    - by user291071
    I know this is simple but I can't get it working! I have no probs with insert,update or select commands, Lets say I have a dictionary and I want to populate a table with the column names in the dictionary what is wrong with my one line where I add a column? ##create con = sqlite3.connect('linksauthor.db') c = con.cursor() c.execute('''create table linksauthor (links text)''') con.commit() c.close() ##populate author columns allauthors={'joe':1,'bla':2,'mo':3} con = sqlite3.connect('linksauthor.db') c = con.cursor() for author in allauthors: print author print type(author) c.execute("alter table linksauthor add column '%s' 'float'")%author ##what is wrong here? con.commit() c.close()

    Read the article

  • The Columns in table <table> do not match an existing primary key or unique constraint

    - by Sven
    I have 2 tables, Stores - storeId (int) and year (int(4)) both Primary Keys. fruit - fruitId - Primary Key and storeId. I need to create 1 to many relationship between the Store and Fruit (Foreign Key held within Fruit) how ever I always get shown the error - The Columns in table <table> do not match an existing primary key or unique constraint. The type's are both int and named the same. Any help would be appreciate in advance, many thanks.

    Read the article

  • ssrs: one static row matrix, multiple columns will not filter out nulls

    - by pbarton99
    Using a ssrs 2005 matrix client side. I want to list the multiple addresses of one person, hence one row, multiple columns. The Column field is =Fields!StreetName.Value. The data details field is =First(Fields!StreetPrefix.Value) & " " & First(Fields!StreetName.Value). The datasource has a row for each address; however, some rows will have nulls since the datasource is composed of outer joins. The column grouping works, but the first column is always empty, (first 2 rows of datasource are null) addresses appear only after the empty column. I want to filter out nulls on the matrix, but its like the filter is ignored. I have also tried having the dataset return an empty string for a null streetname and setting the filter to =Fields!StreetName.Value != ="" but no difference. What am I missing?

    Read the article

  • MySQL: Get unique values across multiple columns in alphabetical order

    - by RuCh
    Hey everyone, If my table looks like this: id | colA | colB | colC =========================== 1 | red | blue | yellow 2 | orange | red | red 3 | orange | blue | cyan What SELECT query do I run such that the results returned are: blue, cyan, orange, red, yellow Basically, I want to extract a collective list of distinct values across multiple columns and return them in alphabetical order. I am not concerned with performance optimization, because the results are being parsed to an XML file that will serve as a cache (database is hardly updated). So even a dirty solution would be fine. Thanks for any help!

    Read the article

  • retrieve columns from sqlite3

    - by John Smith
    I have two tables in sqlite: CREATE TABLE fruit ('fid' integer, 'name' text); CREATE TABLE basket ('fid1' integer, 'fid2' integer, 'c1' integer, 'c2' integer); basket is supposed to have count c1 of fruit fid1 and c2 of fruit fid2 I created a view fruitbasket; create view fruitbasket as select * from basket inner join fruit a on a.fid=basket.fid1 inner join fruit b on b.fid=basket.fid2; it works (almost) as expected. When I type pragma table_info(fruitbasket); I get the following output 0|fid1|integer|0||0 1|fid2|integer|0||0 2|c1|integer|0||0 3|c2|integer|0||0 4|fid|integer|0||0 5|name|text|0||0 6|fid:1|integer|0||0 7|name:1|text|0||0 The problem is that I cannot seem to SELECT name:1. How can I do it other than going back and re-aliasing the columns?

    Read the article

  • MochaUI: 'A is null' when adding columns

    - by Richard John
    I've just downloaded MochaUI, and I'm playing around trying to build an interface. I've successfully created windows, but I'm having trouble when it comes to layouts with columns. I've included all of the libraries in the same order as the demo, and this is in my init code: window.addEvent('domready', function(){ new MochaUI.Column({ id: 'sideColumn1', placement: 'left', width: 200, resizeLimit: [100, 300] }); }); When run, no column is created and I get the error: A is null Does anyone have any ideas? Thanks!

    Read the article

  • LINQ2SQL: how to merge two columns from the same table into a single list

    - by TomL
    this is probably a simple question, but I'm only a beginner so... Suppose I have a table containing home-work locations (cities) certain people use. Something like: ID(int), namePerson(string), homeLocation(string), workLocation(string) where homeLocation and workLocation can both be null. Now I want all the different locations that are used merged into a single list. Something like: var homeLocation = from hm in Places where hm.Home != null select hm.Home; var workLocation = from wk in Places where wk.Work != null select wk.Work; List<string> locationList = new List<string>(); locationList = homeLocation.Distinct().ToList<string>(); locationList.AddRange(workLocation.Distinct().ToList<string>()); (which I guess would still allow duplicates if they have the same value in both columns, which I don't really want...) My question: how this be put into a single LINQ statement? Thanks in advance for your help!

    Read the article

  • last_login_at not working (null) w/ Authlogic Magic Columns...

    - by bgadoci
    I am using the Authlogicgem for authentication and most of it seems to be working great. Authlogic provides several columns that you can add to your Users table (for example) that it knows to fill in if they are present. i.e. login_count, current_login_ip, last_request_at and last_login_at. All seem to be working fine with the exception of the last_login_at field which is null for each user. Is there anything specific that could be causing this perhaps having to do with the user sessions, etc? I can post code if needed but wasn't sure what would relate to this.

    Read the article

  • (NOT) NULL for NVARCHAR columns

    - by Anders Abel
    Allowing NULL values on a column is normally done to allow the absense of a value to be represented. When using NVARCHAR there is aldready a possibility to have an empty string, without setting the column to NULL. In most cases I cannot see a semantical difference between an NVARCHAR with an empty string and a NULL value for such a column. Setting the column as NOT NULL saves me from having to deal with the possibility of NULL values in the code and it feels better to not have to different representations of "no value" (NULL or an empty string). Will I run into any other problems by setting my NVARCHAR columns to NOT NULL. Performance? Storage size? Anything I've overlooked on the usage of the values in the client code?

    Read the article

  • How do I output JSON columns in jQuery

    - by Mel
    I'm using the qTip jQuery plugin to create dynamic tool tips. The tooltip sends an id to a cfc which runs a query and returns data in JSON format. At the moment, the tooltip loads with the following: {"COLUMNS:" ["BOOKNAME","BOOKDESCRIPTION"["MYBOOK","MYDESC"]]} Here's the jQuery $('#catalog a[href]').each(function() { var gi = parseInt($(this).attr("href").split("=")[1]) $(this).qtip( { content: { url: 'cfcs/viewbooks.cfc?method=bookDetails', data: { bookID: gi }, method: 'get', title: { text: $(this).text(), button: 'Close' } }, api :{ onContentLoad : function(){ } }, }); }); As I mentioned, the data is returned successfully, but I am unsure how to output it and format it with HTML. I tried adding content: '<p>' + data.BOOKNAME + '' to api :{ onContentLoad : function(){ ..... to see if I could get it to output something, but I get a 'data is undefined error' What is the correct way to try and output this data with html formatting? Many thanks!

    Read the article

  • LINQ in SQLite for Windows store app does not have 'ThenBy' to order by multiple columns

    - by user1131657
    I have a Windows 8 store application and I'm using the latest version on SQLite for my database. So I want to return some records from the database and I want to order them by more that one column. However SQLite doesn't seem to have the ThenBy statement? So my LINQ statement is below: from i in connection.Table<MyTable>() where i.Type == type orderby i.Usage_Counter // ThenBy i.ID select i); So how do I sort by multiple columns in SQLite without doing another LINQ statement?

    Read the article

  • Unique constraint on more than 10 columns

    - by tk
    I have a time-series simulation model which has more than 10 input variables. The number of distinct simulation instances would be more than 1 million, and each simulation instance generates a few output rows every day. To save the simulation result in a relational database, i designed tables like this. Table SimulationModel { simul_id : integer (primary key), input0 : string or numeric, input1 : string or numeric, ...} Table SimulationOutput { dt : DateTime (primary key), simul_id : integer (primary key), output0 : numeric, ...} My question is, is it fine to put an unique constraint on all of the input columns of SimulationModel table? If it is not a good idea, then what kind of other options do i have to make sure each model is unique?

    Read the article

  • Adding new "columns" to csv data file in Tcl

    - by George
    Hi All, I am dealing with a "large" measurement data, approximately 30K key-value pairs. The measurements have number of iterations. After each iteration a datafile (non-csv) with 30K kay-value pairs is created. I want to somehow creata a csv file of form: Key1,value of iteration1,value of iteration2,... Key2,value of iteration1,value of iteration2,... Key2,value of iteration1,value of iteration2,... ... Now, I was wondering about efficient way of adding each iteration mesurement data as a columns to csv file in Tcl. So, far it seems that in either case I will need to load whole csv file into some variable(array/list) and work on each element by adding new measurement data. This seems somewhat inefficient. Is there another way, perhaps?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >