Search Results

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

Page 101/489 | < Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >

  • How to Display result of subquery rows as one column in MySQL?

    - by SIA
    Hi I have three tables Category, Movies and RelCatMov Category-table categoryid, categoryName 1 thriller 2 supsense 3 romantic 4 action 5 sci-fi Movies-table movieid, movieName 1 Avataar 2 Titanic 3 NinjaAssassin RelCatMov-table categoryid, MovieID 1 1 2 2 3 2 4 2 5 2 Now i Want to display a the record as MovieName Categories Titanic Suspense,Romantic,Sci-fi,action How to do this. I am writing a query select MovieName,(select categoryname from category b,relcatmov c where b.categoryid=c.categoryid and c.movieid=a.movieid) as categories from movies a; Error: Subquery returns more than one row!!! How to display the result of rows in one column? Please help!!!

    Read the article

  • How to skip all the column names in MySQL when the table has auto increment primary key?

    - by Jian Lin
    A table is: mysql> desc gifts; +---------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+----------------+ | giftID | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(80) | YES | | NULL | | | filename | varchar(80) | YES | | NULL | | | effectiveTime | datetime | YES | | NULL | | +---------------+-------------+------+-----+---------+----------------+ the following is ok: mysql> insert into gifts -> values (10, "heart", "heart_shape.jpg", now()); Query OK, 1 row affected (0.05 sec) but is there a way to not specify the "10"... and just let each one be 11, 12, 13... ? I can do it using mysql> insert into gifts (name, filename, effectiveTime) -> values ("coffee", "coffee123.jpg", now()); Query OK, 1 row affected (0.00 sec) but the column names need to be all specified. Is there a way that they don't have to be specified and the auto increment of primary key still works? thanks.

    Read the article

  • How to replace the nth column/field in a comma-separated string using sed/awk?

    - by Peter Meier
    assume I have a string "1,2,3,4" Now I want to replace, e.g. the 3rd field of the string by some different value. "1,2,NEW,4" I managed to do this with the following command: echo "1,2,3,4" | awk -F, -v OFS=, '{$3="NEW"; print }' Now the index for the column to be replaced should be passed as a variable. So in this case index=3 How can I pass this to awk? Because this won't work: echo "1,2,3,4" | awk -F, -v OFS=, '{$index="NEW"; print }' echo "1,2,3,4" | awk -F, -v OFS=, '{$($index)="NEW"; print }' echo "1,2,3,4" | awk -F, -v OFS=, '{\$$index="NEW"; print }' Thanks for your help!

    Read the article

  • Why is doing a top(1) on an indexed column in SQL Server slow?

    - by reinier
    I'm puzzled by the following. I have a DB with around 10 million rows, and (among other indices) on 1 column (campaignid_int) is an index. Now I have 700k rows where the campaignid is indeed 3835 For all these rows, the connectionid is the same. I just want to find out this connectionid. use messaging_db; SELECT TOP (1) connectionid FROM outgoing_messages WITH (NOLOCK) WHERE (campaignid_int = 3835) Now this query takes approx 30 seconds to perform! I (with my small db knowledge) would expect that it would take any of the rows, and return me that connectionid If I test this same query for a campaign which only has 1 entry, it goes really fast. So the index works. How would I tackle this and why does this not work? edit: estimated execution plan: select (0%) - top (0%) - clustered index scan (100%)

    Read the article

  • SQL: How can i update a value on a column only if that value is null?

    - by user321185
    Hey, I have an SQL question which may be basic to some but is confusing me. Here is an example of column names for a table 'Person': PersonalID, FirstName, LastName, Car, HairColour, FavDrink, FavFood Let's say that I input the row: 121312, Rayna, Pieterson, BMW123d, Brown, NULL, NULL Now I want to update the values for this person, but only if the new value is not null, Update: 121312, Rayna, Pieterson, NULL, Blonde, Fanta, NULL The new row needs to be: 121312, Rayna, Pieterson, BMW123d, Blonde, Fanta, NULL So I was thinking something along the lines of: Update Person(PersonalID, FirstName, LastName, Car, HairColour, FavDrink, FavFood) set Car = @Car (where @Car is not null), HairColour = @HairColour (where @HairColour...)... etc. My only concern is that I can't group all the conditions at the end of the query because it will require all the values to have the same condition. Can't i do something like Update HairColour if @HairColour is not Null

    Read the article

  • How to Track Number of Changes Occured in a Column? T-SQL - SQL Server

    - by user327387
    For example, i have a column named EmployeeName. Every time a user changes/fix his name, i need to keep a count. If he changes his name twice, then count is 2. Also, i need to store the time of every change employee makes on EmployeeName e.g. if the name essentially is James and time created is 9:00 AM and then employee changes to John on 11:00 AM, i need to preserve this new time and new value as well as the previous one which is James at 9:00 AM. I hope its clear! Thank you guys...Best Answer will be chosen... If this requires a trigger, giving a sketchy pseudo-code will be very much appreciated.

    Read the article

  • In SharePoint, how can the "Issue ID" column of an issues list be included in the detail form (DispF

    - by Jesse C. Slicer
    We've created a pretty standard issue tracking system based off of SharePoint's template with just a few extra columns. On the list view (AllItems.aspx), the first column is called "Issue ID" and has a number. Our developers and QC use that number in discussions. However, that number doesn't seem to want to show up on the detail form (DispForm.aspx) nor in the alert email. Can this field be included in at least one of these communication methods? If so, how? Thank you.

    Read the article

  • Why is doing a top(1) on an indexed column in mssql slow?

    - by reinier
    I'm puzzled by the following. I have a DB with around 10 million rows, and (among other indices) on 1 column is an index. Now I have 700k rows where the campaignid is indeed 3835 For all these rows, the connectionid is the same. I just want to find out this connectionid. use messaging_db; SELECT TOP (1) connectionid FROM outgoing_messages WITH (NOLOCK) WHERE (campaignid_int = 3835) Now this query takes approx 30 seconds to perform! I (with my small db knowledge) would expect that it would take any of the rows, and return me that connectionid If I test this same query for a campaign which only has 1 entry, it goes really fast. So the index works. How would I tackle this and why does this not work?

    Read the article

  • update a column in input file by taking value from Database in perl.

    - by Rahul Singh
    input file: 1,a,USA,, 2,b,UK,, 3,c,USA,, i want to update the 4th column in the input file from taking values from one of the table. my code looks like this: my $customer_dbh = DBI-connect("DBI:Oracle:$INST", $USER, $PASS ) or die "Couldn't connect to datbase $INST"; my $cust_smh; print "connected \n "; open FILE , "+$input_file" or die "can't open the input file"; print "echo \n"; while(my $line=) { my @line_a=split(/\,/,$line); my $customer_id=$line_a[3]; print "$customer_id\n"; $cust_smh = $customer_dbh-prepare("SELECT phone_no from book where number = $line_a[0]"); $cust_smh-execute() or die "Couldn't execute stmt, error : $DBI::errstr"; my $number = $cust_smh-fetchrow_array(); $line_a[3]=$number; }

    Read the article

  • How do I get the median/mode/range of a column in SQL using Java?

    - by Derek
    I have to get the median, mode and range of test scores from one column in a table but I am unsure how to go about doing that. When you connect to the database using java, you are normally returned a ResultSet that you can make a table or something out of but how do you get particular numbers or digits? Is there an SQL command to get the median/mode/range or will I have to calculate this myself, and how do you pull out numbers from the table in order to be able to calculate the mode/median/range? Thanks.

    Read the article

  • I need to copy the text from a gridview texbox to the others in the column.

    - by Gilberto Munoz
    This is my code in c# protected void ibtCopiar_Click(object sender, ImageClickEventArgs e) { GridViewRow grdrows = DGPlanilla.Rows[0]; TextBox tb1 = (TextBox)grdrows.FindControl("TextBox1"); string valor = tb1.Text; if (valor != null || valor != "0") { foreach (GridViewRow grdrow in DGPlanilla.Rows) { grdrow.Cells[5].Text = valor; } } } this my code for the button when i debug i see that the value i have in the firts box is pass to the other textboxes in the column, but when it dysplay the page onle the first box show the value i have enter. the other texboxes don´t change.

    Read the article

  • How to retrieve column total when rows are paginated?

    - by Rick
    Hey guys I have a column "price" in a table and I used a pagination script to generate the data displayed. Now the pagination is working perfectly however I am trying to have a final row in my HTML table to show the total of all the price. So I wrote a script to do just that with a foreach loop and it sort of works where it does give me the total of all the price summed up together however it is the sum of all the rows, even the ones that are on following pages. How can I retrieve just the sum of the rows displayed within the pagination? Thank you! Here is the query.. SELECT purchase_log.id, purchase_log.date_purchased, purchase_log.total_cost, purchase_log.payment_status, cart_contents.product_name, members.first_name, members.last_name, members.email FROM purchase_log LEFT JOIN cart_contents ON purchase_log.id = cart_contents.purchase_id LEFT JOIN members ON purchase_log.member_id = members.id GROUP BY id ORDER BY id DESC LIMIT 0,30";

    Read the article

  • How to read a column in a tab-delimited Excel file in C#?

    - by janejanejane
    I have some data of an excel file below. At first, I figured that reading from the file could be done using the Excel Library then using an OLEDB connection. I managed to get the DocumentNo column data with the OLEDB approach. However, when the excel file is closed, I am unable to do the operation because it gives an error that "External table is not in the expected format." How can I read from the file even if it is closed? 10/4/2010 Paid Documents for Document Tracking - Customer 1 Paid Documents for Document Tracking - Customer CoCd Customer Trans.type SG Clearing Clrng doc. Assignment Year DocumentNo Pstng Date Doc. Date Entry Dte Crcy PLDT 5000007 4 4 1/15/2010 25003413 5000007 2010 408000139 1/7/2010 1/5/2010 1/12/2010 PHP PLDT 5000007 4 4 1/15/2010 25003634 5000007 2010 408000068 1/5/2010 12/22/2009 1/10/2010 PHP

    Read the article

  • Fluent NHibernate beginner problem: How to convert single column data to custom class?

    - by Stefan Ahlm
    I am very new to Fluent NHibernate and I have a problem that I cant find the answer to. I have a string column in my database table, containing a mathematical expression i.e: "10 + 15 * 5". On my entity I have a property that I call Formula and this returns a class that contains the mathematical "formula" (not as a string). I beleive this post http://intellect.dk/post/Implementing-custom-types-in-nHibernate.aspx explains how to solve it for NHibernate. But I am not sure... How do I get this working with Fluent NHibernate?

    Read the article

  • R matrix handling expressions aren't evaluated in a function or a "for" loop - Column extract doesn't seem to work

    - by Sal Leggio
    I have an R matrix named ddd. When I enter this, everything works fine: i <- 1 shapiro.test(ddd[,y]) ad.test(ddd[,y]) stem(ddd[,y]) print(y) The calls to Shapiro Wilk, Anderson Darling, and stem all work, and extract the same column. If I put this code in a "for" loop, the calls to Shapiro Wilk, and Anderson Darling stop working, while the the stem & leaf call and the print call continue to work. for (y in 7:10) { shapiro.test(ddd[,y]) ad.test(ddd[,y]) stem(ddd[,y]) print(y) } The decimal point is 1 digit(s) to the right of the | 0 | 0 0 | 899999 1 | 0 [1] 7 The same thing happens if I try and write a function. SW & AD do not work. The other calls do. D <- function (y) { + shapiro.test(ddd[,y]) + ad.test(ddd[,y]) + stem(ddd[,y]) + print(y) } D(9) The decimal point is at the | 9 | 000 9 | 10 | 00000 [1] 9 Why don't all the calls behave the same way?

    Read the article

  • How to align item to the very bottom within flexible box layout column?

    - by Christina Lacey
    So far I have the three columns laid out in a vertical box (can't post images yet so here's a link): http://imgur.com/4Y34c <div id="vbox"> <div id="blck1"></div> <div id="blck2"></div> <div id="blck3"><div id="yellow"></div><div id="blue"></div></div> </div> css #vbox{ display: box; box-orient: vertical; } #vbox > div { box-flex: 1; } The problem is that I don't know how to get the blue box to align to the bottom of the third column.. I tried all the alignment properties, i must be doing something wrong. Any ideas???

    Read the article

  • Using excel, how can I count the number of cells in a column containing the text "true" or "false"?

    - by Jay Elston
    I have a spreadsheet that has a column of cells where each cell contains a single work. I would like to count the occurrences of some words. I can use the COUNTIF function for most words, but if the word is "true" or "false", I get 0. A B 1 apples 2 2 true 0 3 false 0 4 oranges 1 5 apples In the above spreadsheet table, I have these formulas in cells B1, B2, B3 and B4: =COUNTIF(A1:A5,"apples") =COUNTIF(A1:A5,"true") =COUNTIF(A1:A5,"false") =COUNTIF(A1:A5,"oranges) As you can see, I can count apples, but not true or false. I have also tried this: =COUNTIF(A1:A5,TRUE) But that does not work either. Note -- I am using Excel 2007.

    Read the article

  • Was: Not unique table :: Now: #1054 - Unknown column - can't understand why!?

    - by Andy Barlow
    Hi! I'm trying to join some tables together in MySQL, but I seem to get an error saying: #1066 - Not unique table/alias: 'calendar_jobs' I really want it to select everything from the cal_events, the 2 user bits and just the destination col from the jobs table, but become "null" if there arn't any job. A right join seemed to fit the bill but doesn't work! Can anyone help!? UPDATE: Thanks for the help on the previous query, I'm now up to this: SELECT calendar_events.* , calendar_users.doctorOrNurse, calendar_users.passportName, calendar_jobs.destination FROM `calendar_events` , `calendar_users` RIGHT JOIN calendar_jobs ON calendar_events.jobID = calendar_jobs.jobID WHERE `start` >= 0 AND calendar_users.userID = calendar_events.userID; But am now getting an error saying: #1054 - Unknown column 'calendar_events.jobID' in 'on clause' What is it this time!? Thanks again!

    Read the article

  • Use a named custom column in SQL 2005 in WHERE clause?

    - by Orange Kid
    Can I name a custom column in the SELECT statement and reference that in the WHERE clause without duplicating code? For example; SELECT RIGHT(REPLICATE('0', 5) + RTRIM(SOME_ID)), 5) AS DISPLAY_ID FROM dbo.MY_TABLE WHERE DISPLAY_ID LIKE '%005%' Only much more complicated. I want to maintain this code in one place only but SQL Server 2005 forces me to duplicate the custom SELECT in the WHERE clause. I believe this was possible in Microsoft SQL Server 2000 but no longer in 2005. Thanks.

    Read the article

  • Unknown Column 'template' in where clause, while using a stored procedure.

    - by sai
    Hello, I have a stored procedure, which has got executed without any errors, but gives me an error "#1054: Unknown column 'templateName' in where clause" when I run it. The stored procedure is delimiter // DROP PROCEDURE getData// CREATE DEFINER=root@localhost PROCEDURE getData(IN templateName VARCHAR(45),IN templateVersion VARCHAR(45),IN userId VARCHAR(45)) BEGIN set @version = CONCAT("SELECT 'saveOEMsData_answersVersion' FROM saveOEMsData where 'saveOEMsData_templateName' = ",templateName," and 'saveOEMsData_templateVersion' = ",templateVersion," and 'saveOEMsData_userId'= ",userId); PREPARE s1 from @version; EXECUTE S1; END // delimiter ; Now I call it using "call getData('templateName','1','285');". And whenever I call it, I get the mentioned error. What could the problem be?? It surely is syntactical, I have been reading the mysql manuals for 2 days and have come out without!! Any help would be great!! Thanks

    Read the article

  • What will happen if I change the type of a column from int to year?

    - by MachinationX
    I have a table in MySQL 4.0 which currently has a year field as a smallint(6) type. What will happen if I convert it directly to a Year type with a query like the following: ALTER TABLE t MODIFY y YEAR(4) NOT NULL DEFAULT CURRENT_TIMESTAMP; When the current members of column y have values like 2010? I assume that because the year type is technically values from 1-255, values above that will be truncated or broken. So if MySQL isn't smart enough to realize that 2010(int) = 110(year), what would be the simplest query or queries to convert the values? Thanks for your help!

    Read the article

  • How to introduce multi-column constraint with JPA annotations?

    - by plouh
    I am trying to introduce a multi-key constraint on a JPA-mapped entity: public class InventoryItem { @Id private Long id; @Version private Long version; @ManyToOne @JoinColumn("productId") private Product product; @Column(nullable=false); private long serial; } Basically (product, serial) pair should be unique, but I only found a way to say that serial should be unique. This obviously isn't a good idea since different products might have same serial numbers. Is there a way to generate this constraint via JPA or am I forced to manually create it to DB?

    Read the article

  • Is there a way to hide a row or column in excel without using VBA?

    - by AJ
    I know of several approaches using a macro (VBA) to show/hide columns and rows in Excel, but I cannot figure out or find a way to do this using either a formula or conditional formatting. Of particular interest is Excel 2007 - but I'd be curious to know if someone has managed to do it in any version of Excel. For those who want background, I have a spread of data with dates across the top and labels down the first column. I would like to specify a date window (on another sheet) as two cells with drop down dates (months) which would then show/hide the appropriate columns on the data sheet.

    Read the article

  • Using Rails, how can I set my primary key to not be an integer-typed column?

    - by Rudd Zwolinski
    I'm using Rails migrations to manage a database schema, and I'm creating a simple table where I'd like to use a non-integer value as the primary key (in particular, a string). To abstract away from my problem, let's say there's a table employees where employees are identified by an alphanumeric string, e.g. "134SNW". I've tried creating the table in a migration like this: create_table :employees, {:primary_key => :emp_id} do |t| t.string :emp_id t.string :first_name t.string :last_name end What this gives me is what seems like it completely ignored the line t.string :emp_id and went ahead and made it an integer column. Is there some other way to have rails generate the PRIMARY_KEY constraint (I'm using PostgreSQL) for me, without having to write the SQL in an execute call? NOTE: I know it's not best to use string columns as primary keys, so please no answers just saying to add an integer primary key. I may add one anyway, but this question is still valid.

    Read the article

  • Datagrid binding 2 datafiled under one column along with an image?

    - by prince23
    hi, here i am performing nested grid operation where in my first datagrid . have name,age,address once user clicks the row we will be showing another grid that is with data Subject name and Score untill here the functionality works fine . 1:now the Question is that i should be displaying an image along with score in the same column( how can i achive this one) 2:Depending on the score i need to show an image( binding different image based on score) 1 :that is if score is 20 show ( ~images/image1.jpg) 2 :that is if score is 40 show ( ~images/image2.jpg) 3 :that is if score is 20 show (~images/ image3.jpg) output [ in a grid format] subject score science 45 image3 maths 50 image2 Computer 60 image1 general 78 image1 how do we solve this issue . any idea how to go ahead. please let me know. hope my question is clear thanks in advance prince

    Read the article

< Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >