I'm writing a query that has to count the number of students enrolled in a course, and the way I'm doing it is like this:
DCount("[student/course table].[Student ID]","[student/course table]","[StartDate] = #" & [Course Start Date] & "# AND Location = '" & tblCourseDetails.Location & "' AND [Course Number] = '" & [Course Number] & "'")
...
The follow query is returning an error at column 143: "ORA-00934: group function is not allowed here"
SELECT * FROM
TBLENTITYLOCATION TL INNER JOIN TBLENTITY TE ON TE.ENTITYID = TL.ENTITYID
WHERE TE.ENTITYNAME = 'foobar'
AND LOCATIONDATETIME = MAX(LOCATIONDATETIME)
It works fine if I take out the last line - AND LOCATIONDATETIME = ...
So I am new to Rails, so pardon the basic question.
I see rails spits this out (in the console) for every request I make to my controller. Why? I'm not even doing any DB operation, I just started writing a HelloWorld rails app. I did pick mysql as the db when creating this rails project (rails -d mysql helloworld)
SQL (0.1ms) SET NA...
Using either a view and/or stored procedure, I can return the results of executing an MDX query against SQL Analysis Services (using OPENROWSET against a linked SSAS Server into SQL).
Unfortunately, the resultset doesn't include a PK field...or for that matter, even a column which COULD act as a PK if I were to hack the model.
Can an...
I have a query which returns a set of numbers:
SELECT Sequence FROM Table1 WHERE Hash=2783342
Returns:
578
642
313
Now, I want to find all rows in the first table where any of that set of numbers is between two other columns. For the purpose of illustration, I am just picking 578, but I also want all of the rest:
SELECT * FROM Tab...
Simplifying what I'm doing somewhat, as an example, say I have the following tables:
declare @elements table (id int, name nvarchar(20))
insert into @elements (id, name) values (1, 'FirstName')
insert into @elements (id, name) values (2, 'Surname')
insert into @elements (id, name) values (3, 'Address')
declare @values table (id int, v...
For example, say I have this SQL Script:
create table Person
(
id int primary key,
name nvarchar(40)
)
create table Country
(
id int primary key,
name nvarchar(40)
)
How can I have those commands in a single file and be able to run it?
...
Hi all,
I'm not exactly sure how to phrase this, but here goes...
We have a table structure like the following:
Id | Timestamp | Type | Clientid | ..others..
001 | 1234567890 | TYPE1 | CL1234567 |.....
002 | 1234561890 | TYPE1 | CL1234567 |.....
Now for the data given above... I would like to have a const...
Is it possible to have a composite key in mysql(5.1) and if so, what is the syntax?
table a:
column aa,bb
references table b
columns b_aa,b_bb
...
Here's what I have so far:
create table rubro (
id_rubro int primary key,
nombre_rubro nvarchar(150)
)
go
create table cliente (
id_cliente int primary key,
direccion nvarchar(400),
telefono int,
nit int
)
...
I'm trying to run this SQL script but it's not working. It says there is an error near the GO text.
create table rubro
(
id_rubro int primary key,
nombre_rubro nvarchar(150)
);
GO
create table cliente
(
id_cliente int primary key,
direccion nvarchar(400),
telefono int,
nit int
);
...
In countrylanguage,
countrycode | language
US | English
BR | Portuguese
UK | English
in countryname,
countrycode | name
CN | China
BR | Brazil
JP | Japan
"an inner join produces results by selecting combinations of matching rows from the joined tables. However, it cannot find non-matches"
"A left join treats the ...
I manage a small team of developers who up till recently have all been working on independent projects.
We have now all come together to work on one holistic project and its really tough. People are changing things, without consulting other programmers and its very difficult to manage.
We are also working in a pure production environme...
Converting a database of people and addresses from ALL CAPS to Title Case will create a number of improperly capitalized words/names, some examples follow:
MacDonald, PhD, CPA, III
Does anyone know of an existing script that will cleanup all the common problem words? Certainly, it will still leave some mistakes behind (less common name...
Hey,
I'm developing a job service that has features like radial search, full-text search, the ability to do full-text search + disable certain job listings (such as un-checking a textbox and no longer returning full-time jobs).
The developer who is working on Sphinx wants the database information to all be stored as intergers with a ke...
In MSSQL 2008 how can I query for tables with foreign key references to a specific table column?
Let's say I have a table called Audit with an int column called 'ID".
How can I find all the tables in my database that have a foreign key to Audit.ID ?
...
This has been driving me crazy! It must be something simple.
Here is my code:
Select
logid,
row_date,
sum(acdcalls) as 'total calls',
sum(ti_stafftime) as 'total time staffed',
sum(acdtime) as 'time on the phone',
Case acdtime
When acdtime > 0 Then
sum(ti_stafftime/acdtime)
Else '0'
End as MyPercent,
RepLName+', '+RepFName AS Agent,
S...
I need to know of a way to combine multiple SELECT statements in one VIEW? I tried the UNION ALL, but it fails since I am using unique columns to aggregate the GRAND TOTAL.
I am a student this is part of a group project.
I have one table with 4 columns: account, description, short_description, and balance. The COA (chart of accounts) i...
I would like to know if there is a way I can select the relevance score as a column? So I can store for later manipulation
Also is there any way (for trouble shooting) to determine why a row got a relevance? or what words matched. For example when I use WITH QUERY EXPANSION I am getting results and I do not know why they match.
...
I am using the following syntax:
Case
When acdtime != 0 Then sum(CAST(ti_stafftime as DECIMAL)/acdtime)*100
Else '0'
End as MyPercent,
Yet I am still getting this error:
Msg 8134, Level 16, State 1, Line 3
Divide by zero error encountered.
What am I doing wrong here?
My whole query is below:
Select
logid,
row_date,
...