Search Results

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

Page 77/489 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • MySQL Join/Comparison on a DATETIME column (<5.6.4 and > 5.6.4)

    - by Simon
    Suppose i have two tables like so: Events ID (PK int autoInc), Time (datetime), Caption (varchar) Position ID (PK int autoinc), Time (datetime), Easting (float), Northing (float) Is it safe to, for example, list all the events and their position if I am using the Time field as my joining criteria? I.e.: SELECT E.*,P.* FROM Events E JOIN Position P ON E.Time = P.Time OR, even just simply comparing a datetime value (taking into consideration that the parameterized value may contain the fractional seconds part - which MySQL has always accepted) e.g. SELECT E.* FROM Events E WHERE E.Time = @Time I understand MySQL (before version 5.6.4) only stores datetime fields WITHOUT milliseconds. So I would assume this query would function OK. However as of version 5.6.4, I have read MySQL can now store milliseconds with the datetime field. Assuming datetime values are inserted using functions such as NOW(), the milliseconds are truncated (<5.6.4) which I would assume allow the above query to work. However, with version 5.6.4 and later, this could potentially NOT work. I am, and only ever will be interested in second accuracy. If anyone could answer the following questions would be greatly appreciated: In General, how does MySQL compare datetime fields against one another (consider the above query). Is the above query fine, and does it make use of indexes on the time fields? (MySQL < 5.6.4) Is there any way to exclude milliseconds? I.e. when inserting and in conditional joins/selects etc? (MySQL 5.6.4) Will the join query above work? (MySQL 5.6.4) EDIT I know i can cast the datetimes, thanks for those that answered, but i'm trying to tackle the root of the problem here (the fact that the storage type/definition has been changed) and i DO NOT want to use functions in my queries. This negates all my work of optimizing queries applying indexes etc, not to mention having to rewrite all my queries. EDIT2 Can anyone out there suggest a reason NOT to join on a DATETIME field using second accuracy?

    Read the article

  • MySQL table with similar column info - HELP!!!

    - by George Garman
    I have a DB with a table that is named "victim". The form that dumps the info into the table has room for two victims and therefore there is vic1_fname, vic1_lname, vic2_fname, vic2_lname, etc.. (business name, person first, person last, address, city, state, zip) a "1" and "2" of each. Now I want to search the DB and locate listed victims. This is what I have so far: $result = mysql_query( "SELECT victim.* FROM victim WHERE vic1_business_name OR vic2_business_name LIKE '%$search_vic_business_name%' AND vic1_fname OR vic2_fname LIKE '%$search_vic_fname%' AND vic1_lname OR vic2_lname LIKE '%$search_vic_lname%' AND vic1_address OR vic2_address LIKE '%$search_vic_address%' AND vic1_city OR vic2_city LIKE '%$search_vic_city%' AND vic1_state OR vic2_state LIKE '%$search_vic_state%' AND vic1_dob OR vic2_dob LIKE '%$search_vic_dob%' "); <table width="960" style="border: groove;" border=".5"> <tr><th colspan=10>You search results are listed below:</th></tr> <tr> <th>Case Number</th> <th>Business Name</th> <th>First Name</th> <th>Last Name</th> <th>DOB / Age</th> <th>Address</th> <th>City</th> <th>State</th> </tr> <?php while($row = mysql_fetch_array($result)) { ?> <tr> <td align="center"><?php print $row['vic_business_name']; ?></td> <td align="center"><?php print $row['vic_fname']; ?></td> <td align="center"><?php print $row['vic_lname']; ?></td> <td align="center"><?php print $row['vic_dob']; ?></td> <td align="center"><?php print $row['vic_adress']; ?></td> <td align="center"><?php print $row['vic_city']; ?></td> <td align="center"><?php print $row['vic_state']; ?></td> </tr> <?php } ?> </table> The info did not display in the table until I changed the table to this: <tr> <td align="center"><?php print $row['vic1_business_name']; ?></td> <td align="center"><?php print $row['vic1_fname']; ?></td> <td align="center"><?php print $row['vic1_lname']; ?></td> <td align="center"><?php print $row['vic1_dob']; ?></td> <td align="center"><?php print $row['vic1_adress']; ?></td> <td align="center"><?php print $row['vic1_city']; ?></td> <td align="center"><?php print $row['vic1_state']; ?></td> </tr> <tr> <td align="center"><?php print $row['vic2_business_name']; ?></td> <td align="center"><?php print $row['vic2_fname']; ?></td> <td align="center"><?php print $row['vic2_lname']; ?></td> <td align="center"><?php print $row['vic2_dob']; ?></td> <td align="center"><?php print $row['vic2_adress']; ?></td> <td align="center"><?php print $row['vic2_city']; ?></td> <td align="center"><?php print $row['vic2_state']; ?></td> </tr> Now it displays both rows, even if its empty. It doesn't matter if the victim was listed originally as vic1 or vic2, i just want to know if they are a victim. I hope this makes sense. I can't get it to display the way I want, line-by-line, irregardless of whether you are vic1 or vic2.

    Read the article

  • Greatest not null column

    - by Álvaro G. Vicario
    I need to update a row with a formula based on the largest value of two DATETIME columns. I would normally do this: GREATEST(date_one, date_two) However, both columns are allowed to be NULL. I need the greatest date even when the other is NULL (of course, I expect NULL when both are NULL) and GREATEST() returns NULL when one of the columns is NULL. This seems to work: GREATEST(COALESCE(date_one, date_two), COALESCE(date_two, date_one)) But I wonder... am I missing a more straightforward method?

    Read the article

  • R table column order when including the empty string

    - by Libo Cannici
    I have a series of value that include the empty string levels(mydata$phone_partner_products) "" "dont_know" "maybe_interesting" "not_interesting" "very_interesting" "very_not_interesting" If I make a frequencies table I get this table(mydata$phone_partner_products) dont_know maybe_interesting 3752 226 2907 not_interesting very_interesting very_not_interesting 1404 1653 1065 How can I reorder the columns in a more meaningful way? How can I rename the empty string "" level? Thank you a lot in advance.

    Read the article

  • Can I insert rows next to a locked column in Excel?

    - by Tom
    If I lock cells A1:A3000, is there a way to insert rows in columns B-Z? I highlight them and I don't get the option to insert even though it is selected in the lock options. (Bottom line is that I need column A static, not to move.) Any ideas? Is it even possible? Better yet, is there any way to have formulas in column A static, as I insert rows in column B? Column A formulas change cell location when I do so.

    Read the article

  • Counting character count in Access database column ins SQL

    - by jzr
    Good Evening. My problem is possibly very easy, I just have spent some time researching now and probably have a brain lock and unable to solve this, help would be much appreciated. database structure: col1 col2 col3 col4 ==================== 1233+4566+ABCD+CDEF 1233+4566+ACD1+CDEF 1233+4566+D1AF+CDEF I need to count character count in col3, wanted result in from the previous table would be: char count =========== A 3 B 1 C 2 D 3 F 1 1 2 is this possible to achieve by using SQL only? at the moment I am thinking of passing a parameter in to SQL query and count the characters one by one and then sum, however I did not start the VBA part yet, and frankly wouldn't want to do that. this is my query at the moment: PARAMETERS X Long; SELECT First(Mid(TABLE.col3,X,1)) AS [col3 Field], Count(Mid(TABLE.col3,X,1)) AS Dcount FROM TEST GROUP BY Mid(TABLE.col3,X,1) HAVING (((Count(Mid([TABLE].[col3],[X],1)))>=1)); ideas and help are much appreciated, as being said this is probably very for some of your guys, I don't usually work with access and SQL. Thanks.

    Read the article

  • Format TimeSpan in DataGridView column

    - by Dan Neely
    I've seen these questions but both involve methods that aren't available in the CellStyle Format value. I only want to show the hours and minutes portion (16:05); not the seconds as well (16:05:13). I tried forcing the seconds value to zero but still got something like 16:05:00. Short of using a kludge like providing a string or a DateTime (and only showing the hour/minutes part) is there any way I can get the formatting to do what I want.

    Read the article

  • How to join by column name

    - by Daniel Vaca
    I have a table T1 such that gsdv |nsdv |esdv ------------------- 228.90 |216.41|0.00 and a table T2 such that ds |nm -------------------------- 'Non-Revenue Sales'|'ESDV' 'Gross Sales' |'GSDV' 'Net Sales' |'NSDV' How do I get the following table? ds |nm |val --------------------------------- 'Non-Revenue Sales'|'ESDV'|0.00 'Gross Sales' |'GSDV'|228.90 'Net Sales' |'NSDV'|216.41 I know that I can this by doing the following SELECT ds,nm,esdv val FROM T1,T2 WHERE nm = 'esdv' UNION SELECT ds,nm,gsdv val FROM T1,T2 WHERE nm = 'gsdv' UNION SELECT ds,nm,nsdv val FROM T1,T2 WHERE nm = 'nsdv' but I am looking for a more generic/nicer solution. I am using Sybase, but if you can think of a way to do this with other DBMS, please let me know. Thanks.

    Read the article

  • 1054 - Unknown column 'apa_calda' in 'where clause'

    - by sebastian
    Hi, I keep getting this error in mysql. Here is the query: SELECT user_id FROM detalii_contor WHERE tip_contor=apa_calda i want to use this query in a php file but it doesn't give any result. so i tried to write it in the sql command prompt. here is what i tried in the php file: $Q = "SELECT id_contor, den_contor FROM detalii_contor WHERE tip_contor='".$contor."'"; $Q = "SELECT id_contor, den_contor FROM detalii_contor WHERE tip_contor='$contor'"; even without "" or without '' i wanted to get $contor from a form, i also tried with $_POST['util'] and {$_POST['util']} i've also tried to set $contor the value i need, but no result. please help. thanks, Sebastian

    Read the article

  • Aggregate SQL column values by time period

    - by user305688
    I have some numerical data that comes in every 5 minutes (i.e. 288 values per day, and quite a few days worth of data). I need to write a query that can return the sums of all values for each day. So currently the table looks like this: 03/30/2010 00:01:00 -- 553 03/30/2010 00:06:00 -- 558 03/30/2010 00:11:00 -- 565 03/30/2010 00:16:00 -- 565 03/30/2010 00:21:00 -- 558 03/30/2010 00:26:00 -- 566 03/30/2010 00:31:00 -- 553 ... And this goes on for 'x' number of days, I'd like the query to return 'x' number of rows, each of which containing the sum of all the values on each day. Something like this: 03/30/2010 -- <sum> 03/31/2010 -- <sum> 04/01/2010 -- <sum> The query will go inside a Dundas webpart, so unfortunately I can't write custom user functions to assist it. All the logic needs to be in just the one big query. Any help would be appreciated, thanks. I'm trying to get it to work using GROUP BY and DATEPART at the moment, not sure if it's the right way to go about it.

    Read the article

  • Separating MySQL SELECT statement based on data in a column

    - by NightMICU
    Hi everyone, I need to retrieve data (vehicle details, in this case) from a MySQL table tabled and then loop through the results to generate separate lists for each category of vehicle. Is there a simple way to do this without having to have a SELECT statement for each type of vehicle? If I were just doing this for one category, I would use the following: <?php $sql = "SELECT * FROM apparatus WHERE vehicleType = 'Support'; $getSQL = mysql_query($sql); ?> <ul> <?php while ($vehicleData = mysql_fetch_assoc($getSQL)) {?> <li><?php echo $vehicleData['name'];?></li> <?php } ?> </ul> ..etc. Need to do this for four different types of vehicles. Thanks!

    Read the article

  • How to use another type of EditingControl in a single .NET 3.5 DataGridView column ?

    - by too
    Is this possible to have two (or more) different kinds of cells to be displayed interchangeably in single column of C# .Net 3.5 WinForms DataGridView? I know one column has specified single EditingControl type, yet I think grid is flexible enough to do some tricks, I may think of only: Adding as many invisible columns to grid as required types of cells and on CellBeginEdit somehow exchange current cell with other column's cell Creating custom column and custom cell with possibility of changing EditingControl for single cell Which approach is better, is there any other solution, are there any examples ?

    Read the article

  • how to select distinct rows for a column

    - by Satoru.Logic
    Hi, all. I have a table x that's like the one bellow: id | name | observed_value | 1 | a | 100 | 2 | b | 200 | 3 | b | 300 | 4 | a | 150 | 5 | c | 300 | I want to make a query so that in the result set I have exactly one record for one name: (1, a, 100) (2, b, 200) (5, c, 300) If there are multiple records corresponding to a name, say 'a' in the table above, I just pick up one of them. In my current implementation, I make a query like this: select x.* from x , (select distinct name, min(observed_value) as minimum_val from x group by name) x1 where x.name = x1.name and x.observed_value = x1.observed_value; But I think there may be some better way around, please tell me if you know, thanks in advance.

    Read the article

  • Creating Auto Incrementing column in Google Appengine

    - by demos
    What is the easiest and most efficient way to create an auto-increment counter for every data row in google appengine? basically I want to give every row a unique row_number so that I can overcome the issue of only being able to get the first 1000 results in a select query. I can thus add a counter lies between condition and mine all the entires in the table.

    Read the article

  • how to distinct one column when using inner join

    - by kusha
    i am using two table postjob and job location want to distinct jobtitle The query is: select postjob.jobtitle, postjob.industry, postjob.companyname, postjob.jobdescription, postjob.postid, postjob.PostingDate, Job_Location.Location, Job_Location.PostigID from postjob inner join Job_Location on postjob.postid = Job_Location.PostigID Where postjob.industry=' Marketing, Advertising' output of this query http://www.justlocaldial.com/Industry_search.aspx?ind=Marketing,%20Advertising

    Read the article

  • MySql TEXT column?

    - by acidzombie24
    I ran this using MySql and it appears to not like TEXT. With SQL server i use nvarchar(max) What should i use in MySQL? In other tables some fields will be descriptions and may be long so ATM i am thinking fixed length is bad. create table if not exists misc_info ( id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL)ENGINE=INNODB;

    Read the article

  • Create a trigger that updates a column on one table when a column in another table is updated

    - by GigaPr
    Hi, i have two tables Order(id, date, note) and Delivery(Id, Note, Date) I want to create a trigger that updates the date in Delivery when the date is updated in Order. I was thinking to do something like CREATE OR REPLACE TRIGGER your_trigger_name BEFORE UPDATE ON Order DECLARE BEGIN UPDATE Delivery set date = ??? where id = ??? END; How do I get the date and row id? thanks

    Read the article

  • VB.net Dataset display different column

    - by Josh
    Hello, I am sure this has to a comon thing I just can't find it. I am making a combobox from my data source. Basically, This is a projects form and the user needs to select the the primary contact which is contrained by the customer id (GETbyCustomerID) set in another field. I have it working... mostly except the combobox only displays the contact ID which is completely useless to the user. I need to know how to display the First and Last name (both are seperate columns in the table). Any help? I am just using the designer.

    Read the article

  • Using CSS instead of tables to create a centered column of images

    - by pcampbell
    Consider the task of replacing this table with CSS stylings: <table border="1"> <tr><td align="center"> <img src="foo" /> </td></tr> <tr><td align="center"> <img src="bar" /> </td></tr> <tr><td align="center"> <img src="bat" /> </td></tr> </table> The desired output is 3 images stacked on top of each other. The images are centered on the widest of them all. How would you style this markup with <div> around those <img> tags with CSS to achieve the same look?

    Read the article

  • Creating nested fields for column on assignment table?

    - by H O
    I have three models, that represent a many to many relationship - Product, Sale and Product_sale. I have a nested form that allows me to create new products from the sale form - so far, so good. I have, however, added some additional fields to the assignment table - price, for example. How can I set the price on the assignment table from the product form, when it is nested in the sale form? I currently have the code below: <%= sale.fields_for :products do |products_builder| %> <%= render :partial => "products/form", :locals => {:f => products_builder, :form_actions_visible => false} %> <% end -%> I could nest a Product_sale form within the product form, but this would create a new product_sale, which is not what I am looking for. I will most likely need to nest the price field within the product form, to ensure that it updates the correct assignment record (since there could be multiple products on one sale form). How can I use a fields_for loop on the product form to update the existing assignment record that is built when I do @sale.products.build? The assignment record will not yet be saved, so I can not access it using a where clause and edit it that way. Thanks!

    Read the article

  • Oracle - Count distict values of a column

    - by Luciana Borela
    Hi I have this table: Reason|Area_Code|Id x dig 1 x dig 2 y dig 3 h util 4 x dig 5 I'm trying a sql that returns: Reason|Amount of distinct Reason|Area_code x 3 dig y 1 dig h 1 util I will use this result to plot a chart. I don´t have any ideia on how this SQL can be. Could you help me?

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >