I have a file with two columns,
sdfsd 1.3
sdfds 3
sdfsdf 2.1
dsfsdf -1
if x is 2
I want to print sdfsdf 2.1
How to express it in awk (bash or sed is fine too)
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.
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!
I have 2 tables that are related,both have identity columns for primary keys and i am using a vb form to insert data into them,My problem is that i cannot get the child table to get the primary key of the parent table and use this as its foreign key in my database.
the data is inserted fine though no foreign key constraint is made.I am wondering if a trigger will do it and if so how. All my inserting of data is done in vb.
The user wont insert any keys. all these are identity columns that are auto generated. If a trigger is my way out please illustrate with an example.
If there is another way i can do this in VB itself then please advise and an example will be greatly appreciated
Thanks in advance
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
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.
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.
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?
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
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.
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 ?
I have a wide screen and I would like to see the code I edit on multiple columns, like an article in a news paper. Ideally I would want the full screen filled with the content of the file I edit.
I am not interested in displaying multiple views of the same file in multiple windows, that's a different feature.
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.
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?
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;
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!
Example:
I have selected any row and any column, let's say D6.
The data I am looking for is in column H.
So, I want the macro to copy the data in row 6, and column H, i.e. H6.
If I have selected G14, the macro shall copy the data in cell H14, etc.
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?
Hi all,
I have a Sites table that has columns name, and time. The name does not have to be unique. So for example I may have the entries 'hi.com, 5', 'hi.com, 10', 'bye.com, 4'.
I would like to sum up all the unique sites so that i get 'hi.com, 15' and 'bye.com, 4' for plotting purposes. How can I do that?
(For some reference I was looking at http://railscasts.com/episodes/223-charts but I couldn't get the following (translated to my table) to work
def self.total_on(date)
where("date(purchased_at) = ?", date).sum(:total_price)
end
nor do I really understand the syntax of the 'where("date(purchased_at) = ?", date)' part.
Thanks for helping a rails newbie!
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 for 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 idea on how this SQL can be done. Could you help me?
Is there a simple way to see if the xsd code generating C# code has a particular column? Or if you can reference a variable column? table.getColumn("column") instead of table.column?
Hi, I'm here again-
I have something like this
Select A.a, A.b, A.a+A.b as c, (A.a+A.b*2)+A.d as d from Table
But i want to know, if it is possible, to make it work with something like this:
Select A.a,A.b,A.a+A.b as c, (c*2)+A.d as d from Table
Thank you
If I have the following (sample) text file;
year,2008,2009,2010
income,1000,1500,2000
dividends,100,200,300
net profit,1100,1700,2300
expenses,500,600,500
profit,600,1100,1800
Is there a way in Linq that I can select the expenses for 2010 only?
So far I have the following which gets me all the data;
var data = File.ReadAllLines(fileName)
.Select(
l => {
var split = l.CsvSplit();
return split;
}
);
foreach (var item in data)
Console.WriteLine("{0}: ${1}", item[0], item[1]);