I have a table
Id
ParentID
jobName
jobStatus
The root ParentID is 0.
Is it possible is Access to create a query to find a root for a given job.
Database is mdb no linked tables. Access version is 2003. job can be in several grand child level.
Any help would be appreciated.
...
Hello everyone, I hope this is the appropriate place to ask my question.
My mysql query currently looks like this
@records = Record.find(:all, :select => "`records`.id, records.level as level,
(SELECT (count( b.id ) + 1)
FROM records as a, records as b
WHERE a.id = records.id and b.skill > a.skill and b.created_at ='#{vandaag}' ...
Note: These are not homework problems. I am studying dbms on my own, hence these
homework-like questions.
Two tables :
Teachers (teacher_id, teacher_name)
Courses (teacher_id,course_id, course_name)
In order to select teacher names who are not teaching any courses, there are
two queries I can think of :
mysql> explain select teach...
I have two tables :
teachers (teacher_id,teacher_name)
courses (teacher_id,course_id)
And I need to display names of the teachers, teaching maximum number of courses :
mysql> select teachers.teacher_name,tmp1.teacher_id,tmp1.cnt from (select max(tm
p.cnt) as tmpMax from (select teacher_id,count(teacher_id) as cnt from courses g
rou...
I'm trying to SELECT records out of an Events Database (with an EventDate field as Date) that have a EventDate that is in the current month.
I have functions for calculating the first day of the month:
public string GetFirstofMonth(DateTime dt)
{
int thisMonth = dt.Month;
int thisYear = dt.Year;
string firstOfMonth = thisMonth.ToStr...
say i have a table
Id int
Region int
Name nvarchar
select * from table1 where region = 1 and name = 'test'
select * from table1 where name = 'test' and region = 1
will there be a difference in performance?
assume no indexes
is it the same with LINQ?
...
I'm developing an ASP.NET application with VB, and using SQL Command and Connection in VB to grab the data for the page. I have both portions initialized as such:
travelQuery.CommandText = "SELECT [StartLoc], [EndLoc],[TravelTime], [AvgSpeed], [Distance] FROM [TravelTimes] WHERE [TripNum] = '" + lblTrip.Text + "'"
travelConnection.Conn...
Hypothetical example:
I have an SQL table that contains a billion or so transactions:
| Cost | DateTime |
| 1.00 | 2009-01-02 |
| 2.00 | 2009-01-03 |
| 2.00 | 2009-01-04 |
| 3.00 | 2009-01-05 |
| 1.00 | 2009-01-06 |
...
What I want is to pair down the data so that I only see the cost transitions:
| Cost | DateTime |
| 1.00 | 2...
I have the following model
class Command(models.Model):
server = models.ForeignKey(Server)
user_login = models.CharField(max_length=100)
user_run = models.CharField(max_length=100)
host = models.CharField(max_length=100)
ip = models.CharField(max_length=100)
session = models.CharField(max_length=100)
command ...
Hello,
I am asking if it is not only possible to pull data from a MySQL table, but also display each row in either a table or a DIV, preferably a DIV. How would I do so?
Table:
ID |BodyText |Title |
1 |Hello World1 |Title1 |
2 |Hello World2 |Title2 |
etc..
I'd like to put each row into a DIV that...
So I have this weird problem with an SQL Server stored procedure. Basically I have this long and complex procedure. Something like this:
SELECT Table1.col1, Table2.col2, col3
FROM Table1 INNER JOIN Table2
Table2 INNER JOIN Table3
-----------------------
-----------------------
(Lots more joins)
WHERE Table1.Col1 = db...
I have the following query:
INSERT INTO table (a) VALUES (0)
ON DUPLICATE KEY UPDATE a=1
I want the ID of either the insert or the update. Usually I run a second query in order to get this as I believe insert_id() only returns the 'inserted' ID and not the updated ID.
Is there a way to INSERT/UPDATE and retrieve the ID of the row wi...
I have a query that takes input from the end user and compares it to 2 columns individually, and the two columns concatenated.
SELECT f_name, l_name, (f_name + ' ' + l_name) AS full_name
FROM users_table
WHERE f_name = user-input
OR l_name = user-input
OR 'full_name' = user-input
Excuse the massive syntax fail, but I assure you ...
I am using a MS SQL db and I have 3 tables: 'base_info', 'messages', 'config'
bases:
ID Name NameNum
====================================
1 Home 101
2 Castle 102
3 Car 103
messages:
ID Signal RecBy HQ
============================
111 120 Home 1
111 110 Castle 1
111 125 Car...
Hi,
Let be a table like this :
CREATE TABLE `amoreAgentTST01` (
`moname` char(64) NOT NULL DEFAULT '',
`updatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`data` longblob,
PRIMARY KEY (`moname`,`updatetime`)
I have a query to find the oldest records for each distinct 'moname', but only if t...
I have a performance problem with an Oracle select statement that I use in a cursor. In the statement one of the terms in the SELECT clause is expensive to evaluate (it's a PL/SQL procedure call, which accesses the database quite heavily). The WHERE clause and ORDER BY clauses are straightforward, however.
I expected that Oracle woul...
Okay I have two variables in PHP
$username;
$password;
which are initialized to the data retrieved from $_POST variable :)
I have this SQL query
$sql = "SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "')";
But this doesn't works and returns me nothing :(
Can you instruct me into the right...
in Access DB...
I need to extract the itemcode / desc combination for each itemcode in the following table where the desc has been used most frequently.
most frequently could possibly mean that there was only one version (see added record for pear)
in the case of itemcode 777, I'll have to decide later which description version to use....
I have a table(say TableA) with the following schema
A(int) B(int) D (varchar) C(date)
If I write the query
select A, C from TableA where A >=0 order by A asc, B asc, D asc, C asc.
The last row of the query will have the C date column which is largest ( I mean here the latest which is greater than all the other dates).
I...
Hello,
I am trying to run SQL queries using a button click in Delphi, the database is successfully connected everything compiles fine when i enter the query i.e. "Select * from StaffDetails" and then click on run expecting it to show me the results in the DBGrid nothing happens at all the code for the button is as follows
procedu...