This seems like an easy thing, but I'm drawing a blank.
Select * from
....
inner join
(
select JobsID, Value from Jobs where Value **is the highest**
) as MaxJob on MaxJob.CustID = A.CustID
inner join
(
select other information based upon MaxJob.JobID
) as OtherStuff
Is there a nice way to have that first subquery gi...
The objective is below the list of tables.
Tables:
Table: Job
JobID
CustomerID
Value
Year
Table: Customer
CustomerID
CustName
Table: Invoice
SaleAmount
CustomerID
The Objective
Part 1: (easy) I need to select all invoice records and sort by Customer (To place nice w/ Crystal Reports)
Select * from Invoice as A inner join...
Hi,
I have a sub query that returns one column, showing as GroupType, I then want to do a CASE function on this result within the main query, however I get an invalid column name when using the CASE statement.
Can i do this in SQL to do I have to refer to it by a different name
...
Hello,
I am trying to filter results in an sql query using the like statement. Here are the results
/q/my_rat_terrior_is_about_8_just_this_moring_hes_barley_moving_around_panting_heavy_and_shaking_like_shivering/1
/addquestion
/addquestion/Validation
/q/how_do_you_get_a_hamster_out_of_a_wall/2
These are urls that are stored in my data...
Why can't one use an output column in the having clause in postgresql? It doesn't change expressivity of the language anyhow, just forces people to rewrite output column definition in having clause. Is a way to avoid that, apart from putting the whole query as a subquery in SELECT * FROM (...) AS t WHERE condition ?
...
A trying to insert a couple of values received from textboxes into a table in access database.
I have perfectly written my statement without passing value for the primary key in the table since its datatype is set to auto number.
Upon running the program. i click the button that runs the insert statement and i recieve the following err...
I have a SQL Var @SumScore dec(9,4)
I am trying to assign the variable as follows:
SET @SumScore =
(
SELECT Sum(
(
SELECT SUM(etjs.CalculatedScore * sc.PercentOfTotal) as CategoryScore
FROM tblEventTurnJudgeScores etjs
INNER JOIN tblJudgingCriteria jc ON jc.JudgingCriteriaID = et...
I am trying to determine a SCORE from 11 rows in a table.
Those 11 rows are being aggregated into five rows using a ScoringCategoryID column as follows...
ScoringCategoryID CategoryScore PercentOfTotal
---------------------------------------------------------
7 15.00 0.40
8 15.0...
Is there a way to check a CASE when it's in an array:
SELECT CASE [Option] WHEN IN (1, 3, 99) THEN 'Wrong option' ELSE 'You go!' END
...
I have a query with the following syntax:
select x.a as a, x.b as b, x.c as c
from
(select distinct a from foo
order by y) as x
left join zzz....
left join yyy...;
I want to now put in an order by into the outer select statement.
attaching it to the end - it doesn't like the syntax, and putting it before the as is apparent...
Hello,
I am trying to memorize some sql syntax and I have gotten the ALTER TABLE ADD CONSTRAINT syntax down. I believe I am correct when I say that when you use this syntax to add a FOREIGN KEY or PRIMARY KEY constraint, that sql server automatically creates indexes to support the constraint operations. (Is that true...or is it only t...
create table snippet(
id int not null auto_increment,
primary key(id),
idlanguage int not null,
foreign key(idlanguage) references language(id),
iduser int not null,
foreign key(iduser) references user(id),
title varchar(200) not null,
content varchar(max) not null,
rating int,
creationdate datetime
);
I'm getting an error at line 9 ne...
I have some older (broken) code that has a join using a *=
table1.ID *= table2.ID
Is this a left outer join or a right outer join? (My error message indicates it is one of those)
...
I am using SQL Manager Lite to try to run a DDL Create Table script. I am new to Firebird and I don't know why it isn't working. The following script...
create table Contacts (
ID integer not null,
FirstName varchar(64) not null,
LastName varchar(64) ...
HI everyone i tried for 3 days and i'm not able to solve this problem. This is the codes and i have went through it again and again but i found no errors. I tried at a blank page and it worked but when i put it inside the calendar it has the syntax error. Thanks a million for whoever who can assist.
/** QUERY THE DATABASE FOR AN ENTRY F...
Hi everyone i'm getting this syntax problem and i don't see anything wrong with my query. I'm kind of new at SQL as i'm still an undergrad. I'd really appreciate it if you could help me with this. This is the code. :
$results = mysql_query("SELECT event.nameevent,event.eventid
FROM event,sub
WHERE sub.userid=$userid AND event.e...
Hello!
I have two tables:
Unit:
UnitId int PK
Title varchar
UnitOption:
UnitOptionId int PK
UnitId int FK
Title varchar
Quote:
QuoteId int PK
UnitOptionId int FK
Title varchar
I want to create a scalar UDF that takes a QuoteId param and returns a varchar that contains the following description (pseudu):
Quote.Title + '-' + Unit.Ti...
Hello friends, I have two tables:
services
id
client
service
and
clients
id
name
email
How to list table service and bring together the customer name that the customers table? field customer services in the table has the id of the customer at the customer table,
I appreciate the help from you now
...
To fill one variable with a value from a query I can write following:
SET @TargetID = (SELECT TOP 1 ID FROM @bigDataSet ORDER BY date DESC)
To fill multiple variables from this query, eg. something like:
SET (@TargetID, @TargetName) = ....(SELECT TOP 1 ID, [Name] FROM @bigDataSet ORDER BY date DESC)
what can I write?
...