Hello
I have this mysql table:
id - auto_increment
id_stock - int
price - double
date - date
sample data is:
1 1 10.5 2010-08-10
2 1 16.5 2010-08-11
3 2 12.5 2010-08-12
now, i have to group by id_stock and search for the MAX(date) of the stock, then i have to compare the MAX(date) to a date i have to...
I have a table T1, it contains a NAME value (not unique), and a date range (D1 and D2 which are dates)
When NAME are the same, we make a union of the date ranges (e.g. B).
But as a result (X), we need to make intersection of all the date ranges
Edit:
Table T1
NAME | D1 | D2
A | 20100101 | 20101211
B | 20100120 | 20100415
...
So i have this in my database:
INSERT INTO `strange` (`id`, `myKey1`, `myValue1`, `myKey2`, `myValue2`) VALUES
(1, 'sometext', 'somevalue', 'sometext', 'somevalue'),
(2, 'movie1', 'description1', 'movie2', 'description2');
with this code:
<?php
//error_reporting(0);
include "inclusions/entete.php";
$theID = $_GET['id'];
$filename =...
How can I get the top x% of values in a database table.
For example, I have a log file that I loaded into a db table. I would like to throw out the longest running 1% of requests as they skew the data.
Any simple way to do this?
BTW I am using derby database.
Thanks
...
Hi all,
While connecting to a remote SQL Server 2005 from my C# code I get a login error (Login failed for user X) This 'user X' appears to be the windows user, instead of the one I specified in my connection string, that was a SQL Server user.
Anyone knows the problem here? The server is in another machine, and I cannot make changes o...
Am trying to import Excel 2003 data into SQL table for SQL Server 2008.
Tried to add a linked server but have met with little success.
Now am trying to check if there's a way to use the BCP utility to do a BULK insert or BULK operation with OPENROWSET, using a format file to get the Excel mapping.
First of all, how can I create a form...
Hi, I have the following SQL which gets a season for each day in a range of dates, then groups each season by start and end date with number of nights. What it does is not important but my question is which is better, the way I've done it below or use the first select statement as a subquery each time @dateSeasons is used in the second q...
I have a stored procedure that uses this select statement:
SELECT dbo.VendorProgram.id,
dbo.VendorProgram.CODE,
dbo.Programs.ProgramName
+ '-' + dbo.Divisions.Division
+ '-' + dbo.Vendors.Source
+ '-' + dbo.Mediums.Medium
+ '-' + dbo.VendorProgram.content
AS SourceDe...
I have Linked Server to Oracle in SQL Server 2005. There 2 Stored Procs defined. How can I call them in SQL server. One Stored Proc has two OUTPUT parameters. I need to get them in SQL server call
Linked server name is TEST. below are stored procs. I need these SPs separately.
check_lockout(v_id_in, v_out_result, v_lockout_msg);
upda...
I have some simple XML which I would like to parse into an array in PHP so that I can build some dynamic SQL inserts.
Sample XML:
<Data>
<Key>1</Key>
<Column>Value 1</Column>
<Column2>Value 2</Column>
</Data>
Data will be passed to PHP via http POST.
What's the easiest way to do this? There should always be one instance ...
I have the following Stored Procedure, Im looking for the correct syntax so I can play the Comments Value in the Comments column with N in front end the value for Unicode I need save Russian Characters Values
So at the moment the comments value is being passed as such
@comments
I want to do
N@comments but not working
ALTER PROCEDUR...
i have the following working query in mysql...
select * from events e join performance_times pt on e.id = pt.event_id
where pt.performance_date_only > '2010-08-10 00:00:00'
group by pt.performance_date_only
I am having issues getting the group by to work when using this with my edmx file in my mvc app.
I have it working with the jo...
I've got a MySQL statement that selects a name and also makes a ranking.
SELECT t.name,
(SELECT COUNT(*)
FROM my_table1 z
WHERE z.type LIKE '%Blue%'
AND t.type LIKE '%Blue%'
AND (z.score1+ z.score2 + z.score3 + z.score4) >= (t.score1+ t.score2 + t.sco...
I really hope that someone can help me with my problem. I would like to realize a match against query with group_concat.
I need something like this:
Select c.id, p.place
from content c
join place p on p.object_id = c.id
where match(group_concat(p.place)) AGAINST('"string1" "string2" "string3"', IN BOOLEAN MODE)
and not ma...
id login_name login_time
1 aa 2002-09-19
2 bb 2002-12-19
3 bb 2002-12-30
How do I write one SQL statement to find out the latest login_time for the user who has the maximum number of logins. For example, in this sample data, user "bb" has logged in twice and his latest login_time is '2002-12-30'.
...
I have this SQL change script that runs as part of my nant orchestrated DB creation or update:
SET XACT_ABORT ON
BEGIN TRANSACTION
PRINT 'Change MyColumn column to MyNewColumn column in MyTable table'
IF EXISTS (SELECT *
FROM sys.columns
WHERE Name = 'MyColumn' AND Object_id = OBJECT_ID('[dbo].[MyTable]'))
BEGIN
...
I have three tables 'Employees', 'Departments' and 'EmployeesInDepartments'
The 'Employees' tables references the 'Departments' table (Each employee must have a DepartmentId). However, an employee can exist in multiple departments by adding entries (EmployeeId and DepartmentId) to 'EmployeeInDepartments' table.
I currently have the foll...
Google turns up all sorts of discussions on sanitizing queries for web access but I'm not finding anything addressing what I'm concerned with:
Sanitizing user input data in a c# program. This must be done by a reversible transformation, not by removal. As a simple example of the problem I don't want to mangle Irish names.
What's the ...
Hi, I have a field called IntQID, which is an id for each post that is recorded in the SQL database. If a post is 1533, the next entery will be 1534,1535, etc...
I recently messed up and inserted a manual entry with an ID of 4000. Now the counter has been using that as the last entry, so now new posted are 4001, 4002, 4003.
How do I ch...
I'm really confused on how to go about doing this.
- I want to be able to upload an excel sheet from my web app using the fileupload control.
- Next, I want to read each individual row under the first row. (so starting from row 2, row 1 will be the column title).
- Finally, I want to pass the Strings I've read into another method that'll...