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 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.
Hi, can you help me with sql query?
I have this problem:
I have two tables
"Join" table: Reservation_has_meal
+----------------+
| id_reservation |
| id_meal |
| pieces |
+----------------+
and table with data: Meal
+-------------+
| id_meal |
| name |
+-------------+
Sample data for
Meal:
1 | carrot
2 | potatoe
3 | cucumber
Reservation_has_meal
1 | 2 | 5230
1 | 3 | 1203
How can I get this result for reservation with id_reservation=1:
id_meal | id_Reservation | name | pcs |
--------------------------------------------
1 | 1 | carrot | null|
2 | 1 | potatoe | 5230|
3 | 1 | cucumber | 1203|
--------------------------------------------
And result for id_reservation = 2:
id_meal | id_Reservation | name | pcs |
--------------------------------------------
1 | 2 | carrot | null|
2 | 2 | potatoe | null|
3 | 2 | cucumber | null|
--------------------------------------------
Thanks for advice.
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
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 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.
I have grid named 'GridView1' and displaying columns like this
<asp:GridView ID="GridView1" OnRowCommand="ScheduleGridView_RowCommand"
runat="server" AutoGenerateColumns="False" Height="60px"
Style="text-align: center" Width="869px" EnableViewState="False">
<Columns>
<asp:BoundField HeaderText="Topic" DataField="Topic" />
<asp:BoundField DataField="Moderator" HeaderText="Moderator" />
<asp:BoundField DataField="Expert" HeaderText="Expert" />
<asp:BoundField DataField="StartTime" HeaderText="Start" >
<HeaderStyle Width="175px" />
</asp:BoundField>
<asp:BoundField DataField="EndTime" HeaderText="End" >
<HeaderStyle Width="175px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Join" ShowHeader="False">
<ItemTemplate>
<asp:Button ID="JoinBT" runat="server" CommandArgument="<%# Container.DataItemIndex %>"
CommandName="Join" Text="Join" Width="52px" />
</ItemTemplate>
<HeaderStyle Height="15px" />
</asp:TemplateField>
</Columns>
</asp:GridView>
Here what is my requirement is whenever we right click on each row in gridview ,it should display three option join meeting(if we click it will go to
meeting.aspx),,view details(will go to detail.aspx),,Subscribe(subscribe.aspx) just like when we click right any where we can see view,sortby,refresh
like that..Do we need to implement javascript here
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'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.
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?
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]);
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.
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 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 data in a table, but am working on data loading. I want to reseed all new inserts for testing.
What would be the line to set all new inserts to a certain seed value?
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 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
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.
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'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
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?
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 have the following table in an access database
id VisitNo Weight
1 1 100
1 2 95
1 3 96
1 4 94
1 5 93
Now row 2 and 4 are deleted. So i have...
id VisitNo Weight
1 1 100
1 3 96
1 5 93
However what i need is...
id VisitNo Weight
1 1 100
1 2 96
1 3 93
What is the SQL query i need to accomplish the above?
thanks
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?