Hey everyone,
I am trying to run a simple SQL statement with DB2 and am having a few problems.
I would like to have a single script in a txt/db2 file and have the engine process all of the commands
Here is the script:
CONNECT TO MYDB
CREATE TABLE PERSONS(
PID SMALLINT NOT NULL,
NAME VARCHAR(20) NOT NULL
)
TERMINATE
When ...
According to the user's input I want to select the record from the database. This is my code:
<%
String jempid=request.getParameter("empid");
out.println(jempid);
int intempid=1223;
Connection conn=null;
String url="jdbc:mysql://localhost/employees";
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn=DriverManager.getConnection...
I have a really weird issue with an SQL query I've been working with for some time. I'm using SQL Server 2005.
Here's an example table from which the query is made:
Log:
Log_ID | FB_ID | Date | Log_Name | Log_Type
7 | 4 | 2007/11/8 | Nina | Critical
6 | 4 | 2007/11/6 | John | Critical
5 | 4 |...
Currently I would simply like to find all files that have not been modified in the last X days but ultimately I would like to be able to make more complex queries against my subversion repository.
Is there a Subversion Query Language of some sort or an API that I could use?
...
SELECT sysobjects.xtype, syscolumns.name, sysindexkeys.indid, sysobjects.type
FROM
syscolumns
LEFT JOIN sysobjects ON syscolumns.id = sysobjects.id
LEFT JOIN sysindexkeys ON (
syscolumns.id = sysindexkeys.id AND syscolumns.colid = sysindexkeys.colid
)
WHERE sysobjects.name = '{$table}'
AND sysindexkeys.indid IS NOT NULL
ORDER BY...
Is it possible to build a single mysql query (without variables) to remove all records from the table, except latest N (sorted by id desc)?
Something like this, only it doesn't work :)
delete from table order by id ASC limit ((select count(*) from table ) - N)
Thanks.
...
In my db, I have a table "customerNames" which has two columns "Id" and "Name" and approx. 1,000 results. I am creating a functionality where I have to pick up the 5 customers randomly every time. Can anyone tell me how to create a query which will get random 5 rows (Id, and Name) every time when query is executed.
edited
I am using M...
I have 2 tables:
'Users' Table
id username
---- --------
0001 user1
0002 user2
0003 user3
0004 user4
'Friends' Table
user_id friend_id friend
------- --------- ------
0001 0004 1
0002 0004 1
0005 0004 0
How do I display all user4 friends'...
I had the following code
<?php
$getFriendQuery = "SELECT DISTINCT U.username FROM users as U INNER JOIN test_friends as F on U.Id = F.user_id WHERE F.friend_id = '{$userID}' && F.active=1";
$getFriendResult = mysql_query($getFriendQuery, $conn) or die (mysql_error());
$friendName = "";
while($getFriendFetch = mysql_fetch_assoc($ge...
I'm a total newbie when it comes to SQL. I'm making a site in ASP.NET for doing surveys. A privileged admin user will be able to build a survey. Then lots of other people will respond to the survey.
Once I have the set of questions for a new survey, what is the best way to automatically construct a table and an INSERT query to store t...
I hava a problem with this mssql_query in PHP :
$query = 'SELECT Ville FROM tblLstManufacturiers where province = "Québec"';
The result is empty because I have an accent in Québec
How can I do this?
...
Is there a way to add a property to the objects of a Linq query result other than the following?
var query = from x in db.Courses
select new
{
x.OldProperty1,
x.OldProperty2,
x.OldProperty3,
NewProperty = true
...
Using these tables, as a sample:
Table CodeVariations
CODE
-----------
ABC_012
DEF_024
JKLX048
And table RegisteredCodes
CODE AMOUNT
-------- ------
ABCM012 5
ABCK012 25
JKLM048 16
Is it possible to write a query to retrieve all rows in RegisteredCodes when CODE matches a pattern in any row of the Cod...
How do I check if an sqlite query returned anything before I stop looping through results.
//see if there are results and do something if not
while(sqlite3_step(selectstmt) == SQLITE_ROW)
{ /*process on reults */}
...
I'm using a query which generally executes in under a second, but sometimes takes between 10-40 seconds to finish. I'm actually not totally clear on how the subquery works, I just know that it works, in that it gives me 15 rows for each faverprofileid.
I'm logging slow queries and it's telling me 5823244 rows were examined, which is odd...
Which is the valid syntax of this query in MySQL?
SELECT * FROM courses WHERE (now() + 2 hours) > start_time
*note: start_time is a field of courses table*
...
considering this code
Dim cn As New ADODB.Connection, cn2 As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim connString As String
Dim SelectFieldName
Set cn = CurrentProject.Connection
SelectFieldName = astrField...
I am lost in a big database and I am not able to find where the data I get comes from. I was wondering if it is possible with SQL Server 2005 to search for a string in an all the tables, rows and columns of a DB?
Does anybody has an idea if it is possible and how?
Thanks!
...
What would be the best (or fastest) way to find all the possible values of "foo" in the following example array.
var table = [
{foo: 0, bar:"htns", stuff:123},
{foo: 2, bar:"snhn", stuff:156},
{foo: 5, bar:"trltw", stuff:45},
{foo: 5, bar:"lrctm", stuff:564},
//few thousand lines later
{foo: 2596, bar:"cns", stuf...
I am trying to make a query that pulls out all Tickets for a particular company.
Within that table will be a column named [Repeat]
What I need the query to do is check to see if there are any other rows that have a matching Circuit_ID within the last 30days of that ticket.
"SELECT [MAIN_TICKET_ID], [CompID], [ActMTTR], [ActOTR], [DtCr]...