Hello all,
Please help a newbe ;-)
Have a little problem with to make a sql-query as I want to have it...
The problem is I need to check in 3 tables and count out and get it presentated
per n_id like
n_id counted
01 5
02 10
03 2
My tables look as follows...
In sub:
id
n_id
Sorry, I have missed information in my earlir question, that I have added below.
Joppe A wrote:
Hello all, Please help a newbie ;-) Have a little problem with to
make a sql-query as I want to have it... The problem is I need to
check in 3 tables and count out and get it presentated per
I'm banging my head against a somewhat strange problem I hope somewhat
more proficient than me can help me with.
I'm trying to setup a central logging-server and having it dump all
input into a MySQL db for easier access from diferent analisys systems.
I've found sysklogd-sql on Sourceforge,
Suppose I have two tables: parent and
child. I want to create an SQL statement
that will get the count of all children
belonging to parent. Is this possible in
one statement? The one I have works
if parent has children, but not if the
number of children is 0. Here's what
I have:
SELECT
Dean A. Hoover wrote:
Suppose I have two tables: parent and
child. I want to create an SQL statement
that will get the count of all children
belonging to parent. Is this possible in
one statement? The one I have works
if parent has children, but not if the
number of children is 0. Here's what
I
Suppose I have two tables: parent and
child. I want to create an SQL statement
that will get the count of all children
belonging to parent. Is this possible in
one statement? The one I have works
if parent has children, but not if the
number of children is 0. Here's what
I have:
SELECT
Jim Grill wrote:
Suppose I have two tables: parent and
child. I want to create an SQL statement
that will get the count of all children
belonging to parent. Is this possible in
one statement? The one I have works
if parent has children, but not if the
number of children is 0. Here's what
I have:
Now, to complicate things further, suppose there is
yet another table (grandparent, let's say) and there is
a column in parent that is grandparent_id. I only want
results where parent.grandparent_id = 'Fred'. How do
I do that? Is it with a WHERE clause or some other
SQL magic?
Dean
Daniel Kasak
Dean A. Hoover wrote:
Now, to complicate things further, suppose there is
yet another table (grandparent, let's say) and there is
a column in parent that is grandparent_id. I only want
results where parent.grandparent_id = 'Fred'. How do
I do that? Is it with a WHERE clause or some other
SQL
Now, to complicate things further, suppose there is
yet another table (grandparent, let's say) and there is
a column in parent that is grandparent_id. I only want
results where parent.grandparent_id = 'Fred'. How do
I do that? Is it with a WHERE clause or some other
SQL magic?
Dean
This
Matthew Stuart wrote:
I have a home page where I need to show three news articles which are
specified by the administrator - so it might not be the latest
articles and they might not be in any order. I have designed the db to
have two tables to fulfill this function the first table 'tbl_press'
Matthew Stuart wrote
I have a home page where I need to show three news articles which are
specified by the administrator - so it might not be the latest articles
and they might not be in any order. I have designed the db to have two
tables to fulfill this function the first table 'tbl_press'
Your syntax is wrong, or at least not standard, if you are trying to do
multiple left joins.
Your ordering is not your typical for a query.
And you say there instead of where.
Your query should be structure like this:
SELECT fields
FROM table, table,...
LEFT JOIN table ON join condition
LEFT
Thanks to You Brent and Bill Easton
and Sorry
Hrmm , that what happen when not clipping direct into mail program ,
here is the Original :-) :
Select A.DepartmentName,A.Address,P.Postcode,P.cityname,CP.firstname
from caddress A,cpostinfo P
left Join CContactPerson CP , caddresscontactperson
on CACP.ContactpersonID=CP.ID and CACP.AddressID=A.ID
left join ccontactinfo CCI
on CACP.ID=CCI.AddressContactPersonID
and CCI.AddressID=-1 and CCI.ContactInfoTypeID=1
where A.ID=10 and A.PostInfoID=P.ID
Date: Wed, 12 Nov 2003 23:20:10 +0100 (CET)
Subject: Sql - Problem
Hello ,
I have a problem with constructing correct SQL.
I have tables:
TABLE1 wich have FIELD1 and FIELD2
TABLE2 wich have FIELD1 and FIELD2
TABLE3 wich have FIELD1, FIELD2 and FIELD3
I have this SQL:
select a.field1, a.field2,
: constructing SQL problem
Hello ,
I have a problem with constructing correct SQL.
I have tables:
TABLE1 wich have FIELD1 and FIELD2
TABLE2 wich have FIELD1 and FIELD2
TABLE3 wich have FIELD1, FIELD2 and FIELD3
I have this SQL:
select
Dear Listers,
This is presenting a challenge to my SQL skills of how to attack this,
hopefully someone else might be able to help point me in the right
direction.
I'm building an application to track sports contests. Essentially players,
each of whom are members of a specific club, guess every
It looks like you're missing a comma in your SQL statement in between
placeOfBirth and civilStatus.
Good Luck!
Dennis
- Original Message -
From: Mylin Campos [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 23, 2002 2:13 AM
Subject: sql problem
Hi all,
I just
On Wednesday, Oct 23, 2002, at 00:13 America/Phoenix, Mylin Campos
wrote:
Hi all,
I just wanted to know if you guys can help me out with this error.
It's actually an sql and jdbc error.
I have a class called employeeDBUtil. In this class, it has a method
called updateEmployee. I wanted to
Hi all,
I just wanted to know if you guys can help me out with this error. It's
actually an sql and jdbc error.
I have a class called employeeDBUtil. In this class, it has a method called
updateEmployee. I wanted to try if the code would work so I created a main
portion in my class.
Whoa,
I've had this message 3 times now. Is there a problem somewhere?
George
- Original Message -
From: Ben Edwards [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 28, 2002 3:38 PM
Subject: where exists sql problem
having problems working out sql where exists syntax
Dear all,
I have 2 numeric column a,b in my table.
I want to retrieve rows which a in range
x~y, but b not in this range. So I wrote
a SQL statement
select * from table where
( a x and a y ) and ( b x or b y )
But wrong result returned with this
statement. Is this SQL wrong?
Thanks for
Dear all,
I have 2 numeric column a,b in my table.
I want to retrieve rows which a in range
x~y, but b not in this range. So I wrote
a SQL statement
select * from table where
( a x and a y ) and ( b x or b y )
But wrong result returned with this
statement. Is this SQL wrong?
Thanks for
Dear Vincent,
I have 2 numeric column a,b in my table.
I want to retrieve rows which a in range
x~y, but b not in this range. So I wrote
a SQL statement
select * from table where
( a x and a y ) and ( b x or b y )
But wrong result returned with this
statement. Is this SQL wrong?
G'day all,
For some reason I am receiving messages from the MySQL list (only) which I
have already received - some more the a week ago. Is anyone else getting
repeat posts?
kim
-
Before posting, please check:
Hi
It would be great if anyone could help me with a problem in mySQL.
I have 3 tables to describe attributes for a product database.
e.g.
attribute_type:
++--+--+
| id | name | unit |
++--+--+
| 1 | height | cm |
| 2 | width| cm |
Here's a conundrum I'm having with MySQL.
The following code returns a bunch of records:
SELECT sl_Year,
sl_DayOfYear,
sl_Query,
SUM(sl_CountOfOccurrences) AS NumRequests
FROM SearchLog
GROUP BY sl_Year,
sl_DayOfYear,
sl_Query
one of these records looks
Here's a conundrum I'm having with MySQL.
The following code returns a bunch of records:
SELECT sl_Year,
sl_DayOfYear,
sl_Query,
SUM(sl_CountOfOccurrences) AS NumRequests
FROM SearchLog
GROUP BY sl_Year,
sl_DayOfYear,
sl_Query
one of these
Hi.
This is dicussed here:
http://www.mysql.com/doc/G/r/Group_by_functions.html
(after the function list)
http://www.mysql.com/doc/E/x/Examples.html (see the subsections)
Bye,
Benjamin.
On Sat, Nov 24, 2001 at 11:01:26PM +0530, [EMAIL PROTECTED] wrote:
Hello Everyone,
I wants
Hello Everyone,
I wants to find the max. date and Login status of employee for Attendance
table.
The qurey runs fine but it shows me the wrong status.
select max(a.dAtt_Date),a.nLog_Status from tbl_attendance a,tbl_attendance b
where a.nEmp_id = 1 and a.nLog_Status = b.nLog_Status
group by
i have a MySQL DB whit this tabel:
Id ColPoint CntDateTime Cnt1 Cnt2 Cntx. Cnt32
11 2001-08-01 00:05:0012 14
21 2001-08-01 00:10:0011 12
31 2001-08-01 00:15:00109
41 2001-08-01 00:20:000
SELECT (t1.cnt1 + t2.cnt3 - t3.cnt11) FROM table
t1, table t2, table t3 WHERE t1.ColPoint=1 AND
t2.ColPoint=5 AND t3.ColPoint=2 AND t1.id=1 AND
t2.id=t1.id AND t3.id=t1.id
Of course, self joins can be expensive, this grows
in complexity as you need to add/subtract more
counts ,and this is not
Hello,
I am having a lot of trouble trying to find the best
way to write the SQL to do the following:
I have a table called referrals. In this table I
have a column called ref. The data in the ref column
are of the form p/$promo_id/$date. An example would
be p/26/20010629 which says
I have a problem adapting a multiple select to MySQL.
Can someone help me ?
Here is my request (Oracle format)
SELECT Tactic.teamCode FROM Tactic WHERE
Tactic.teamCode NOT IN (SELECT Game.teamCode1 FROM Game, Turn WHERE
Game.gameTurn = Turn.code)
AND Tactic.teamCode NOT IN (SELECT
AFAIK MySQL does not yet support sub-selects.
--zak
- Original Message -
From: Lefebvre, Cedric [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 28, 2001 12:41 AM
Subject: SQL Problem
I have a problem adapting a multiple select to MySQL.
Can someone help me ?
Here is my
Message -
From: Lefebvre, Cedric [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 28, 2001 14:41
Subject: SQL Problem
I have a problem adapting a multiple select to MySQL.
Can someone help me ?
Here is my request (Oracle format)
SELECT Tactic.teamCode FROM Tactic WHERE
On Mon, 28 May 2001, Lefebvre, Cedric wrote:
I have a problem adapting a multiple select to MySQL.
Can someone help me ?
Here is my request (Oracle format)
SELECT Tactic.teamCode FROM Tactic WHERE
Tactic.teamCode NOT IN (SELECT Game.teamCode1 FROM Game, Turn WHERE
Game.gameTurn =
AND g.gameTurn = r.code;
...and even the table Turn may not be necessary, depending
on the values
in your tables and what you want to do with it.
- Original Message -
From: Lefebvre, Cedric [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 28, 2001 14:41
Subject: SQL
I have a problem adapting a multiple select to MySQL.
Can someone help me ?
Here is my request (Oracle format)
SELECT Tactic.teamCode FROM Tactic WHERE
Tactic.teamCode NOT IN (SELECT Game.teamCode1 FROM Game, Turn WHERE
Game.gameTurn = Turn.code)
AND Tactic.teamCode NOT IN (SELECT
hi everybody !!!
i need to resolve the following query ( a silly one ) in a mysql server
3.22.30
and i get the following error:
mysql select count(distinct ip_dst) from iphdr;
ERROR 1064: You have an error in your SQL syntax near 'distinct ip_dst)
from iphdr' at line 1
mysql
January 24, 2001 13:51
Cc: MySQL List
Subject: sql problem - it may be a version problem ??
hi everybody !!!
i need to resolve the following query ( a silly one ) in a
mysql server
3.22.30
and i get the following error:
mysql select count(distinct ip_dst) from iphdr;
ERROR 1064
42 matches
Mail list logo