data field

M

Marco

I have a query like this from tblMetod (IDSE, theday,...)and UnQryMetod
SELECT Q1.IDSE, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSuperE)>=335))
GROUP BY Q1.IDSE;
ex the result are:
ResultMetod IDSE Matches
336 1
337 2
338 2

Is it possible to have a field data too?
IDSE theday Matches
336 10/04/2006 1
337 11/04/2006 2
338 12/04/2006 2


thx
 
M

Marco

"Marco" wrote
I have a query like this from tblMetod (IDSE, theday,...)and UnQryMetod
SELECT Q1.IDSE, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSuperE)>=335))
excuse me
((Q1.IDSE)>=335))
 
J

John Spencer

Is "theDay" a field in the table? Is it always the same value for each IDSE
value (a one to one match)?

If it is a one to one match then
SELECT Q1.IDSE
, TheDay
, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, TheDay;

If TheDay is a calculated value, then how is it calculated?
 
M

Marco

"John Spencer" wrote
Is "theDay" a field in the table?

yes, it's data field in tblMetod
Is it always the same value for each IDSE
every id have a different data ex id 1 10/04/06, 2 11/04/06...
value (a one to one match)?

If it is a one to one match then
the matches don't count data field but other field of table
SELECT Q1.IDSE
, TheDay
, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, TheDay;

this query is based on an other query UnQryMetod ,
SELECT IDSE, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
..........

SELECT IDSE, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
........

UNION SELECT IDSE, 2 AS [Set], G12 AS [Value] FROM [tblMetod];

UnQryMetod on tblMetod

thx

If TheDay is a calculated value, then how is it calculated?

Marco said:
I have a query like this from tblMetod (IDSE, theday,...)and UnQryMetod
SELECT Q1.IDSE, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSuperE)>=335))
GROUP BY Q1.IDSE;
ex the result are:
ResultMetod IDSE Matches
336 1
337 2
338 2

Is it possible to have a field data too?
IDSE theday Matches
336 10/04/2006 1
337 11/04/2006 2
338 12/04/2006 2


thx
 
J

John Spencer

You need to go back the Union query and add in the date field to all parts
of the union query. Then the fiedl will be available in the query based on
the union query. Also, I should have prefaced the field name with the query
alias.

SELECT Q1.IDSE
, Q1.TheDay
, Count(*) as Matches
FROM ...

Marco said:
"John Spencer" wrote
Is "theDay" a field in the table?

yes, it's data field in tblMetod
Is it always the same value for each IDSE
every id have a different data ex id 1 10/04/06, 2 11/04/06...
value (a one to one match)?

If it is a one to one match then
the matches don't count data field but other field of table
SELECT Q1.IDSE
, TheDay
, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, TheDay;

this query is based on an other query UnQryMetod ,
SELECT IDSE, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
.........

SELECT IDSE, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
.......

UNION SELECT IDSE, 2 AS [Set], G12 AS [Value] FROM [tblMetod];

UnQryMetod on tblMetod

thx

If TheDay is a calculated value, then how is it calculated?

Marco said:
I have a query like this from tblMetod (IDSE, theday,...)and UnQryMetod
SELECT Q1.IDSE, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSuperE)>=335))
GROUP BY Q1.IDSE;
ex the result are:
ResultMetod IDSE Matches
336 1
337 2
338 2

Is it possible to have a field data too?
IDSE theday Matches
336 10/04/2006 1
337 11/04/2006 2
338 12/04/2006 2


thx
 
M

Marco

SELECT IDSE, TheDay, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, TheDay, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
..........
SELECT IDSE, TheDay, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, TheDay, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
........
UNION SELECT IDSE, TheDay, 2 AS [Set], G12 AS [Value] FROM [tblMetod];
_ _ _ _
SELECT Q1.IDSE, Q1.TheDay, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, Q1.TheDay;
is it correct ?
thx


"John Spencer" wrote
You need to go back the Union query and add in the date field to all parts
of the union query. Then the fiedl will be available in the query based
on the union query. Also, I should have prefaced the field name with the
query alias.

SELECT Q1.IDSE
, Q1.TheDay
, Count(*) as Matches
FROM ...

Marco said:
"John Spencer" wrote
Is "theDay" a field in the table?

yes, it's data field in tblMetod
Is it always the same value for each IDSE
every id have a different data ex id 1 10/04/06, 2 11/04/06...
value (a one to one match)?

If it is a one to one match then
the matches don't count data field but other field of table
SELECT Q1.IDSE
, TheDay
, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, TheDay;

this query is based on an other query UnQryMetod ,
SELECT IDSE, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
.........

SELECT IDSE, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
.......

UNION SELECT IDSE, 2 AS [Set], G12 AS [Value] FROM [tblMetod];

UnQryMetod on tblMetod

thx

If TheDay is a calculated value, then how is it calculated?

I have a query like this from tblMetod (IDSE, theday,...)and UnQryMetod
SELECT Q1.IDSE, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSuperE)>=335))
GROUP BY Q1.IDSE;
ex the result are:
ResultMetod IDSE Matches
336 1
337 2
338 2

Is it possible to have a field data too?
IDSE theday Matches
336 10/04/2006 1
337 11/04/2006 2
338 12/04/2006 2


thx
 
J

John Spencer

I don't know. I can't test it. Did you test it? If so, did it work?


Marco said:
SELECT IDSE, TheDay, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, TheDay, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
.........
SELECT IDSE, TheDay, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, TheDay, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
.......
UNION SELECT IDSE, TheDay, 2 AS [Set], G12 AS [Value] FROM [tblMetod];
_ _ _ _
SELECT Q1.IDSE, Q1.TheDay, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, Q1.TheDay;
is it correct ?
thx


"John Spencer" wrote
You need to go back the Union query and add in the date field to all
parts of the union query. Then the fiedl will be available in the query
based on the union query. Also, I should have prefaced the field name
with the query alias.

SELECT Q1.IDSE
, Q1.TheDay
, Count(*) as Matches
FROM ...

Marco said:
"John Spencer" wrote
Is "theDay" a field in the table?

yes, it's data field in tblMetod
Is it always the same value for each IDSE
every id have a different data ex id 1 10/04/06, 2 11/04/06...

value (a one to one match)?

If it is a one to one match then
the matches don't count data field but other field of table

SELECT Q1.IDSE
, TheDay
, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, TheDay;

this query is based on an other query UnQryMetod ,
SELECT IDSE, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
.........

SELECT IDSE, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
.......

UNION SELECT IDSE, 2 AS [Set], G12 AS [Value] FROM [tblMetod];

UnQryMetod on tblMetod

thx



If TheDay is a calculated value, then how is it calculated?

I have a query like this from tblMetod (IDSE, theday,...)and
UnQryMetod
SELECT Q1.IDSE, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSuperE)>=335))
GROUP BY Q1.IDSE;
ex the result are:
ResultMetod IDSE Matches
336 1
337 2
338 2

Is it possible to have a field data too?
IDSE theday Matches
336 10/04/2006 1
337 11/04/2006 2
338 12/04/2006 2


thx
 
M

Marco

"John Spencer" wrote
I don't know. I can't test it. Did you test it? If so, did it work?

If the syntax is corrected, yes.
I hoped myself in a faster method. ;-)
I have *only* 70 queries in various database ...
Marco said:
SELECT IDSE, TheDay, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, TheDay, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
.........
SELECT IDSE, TheDay, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, TheDay, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
.......
UNION SELECT IDSE, TheDay, 2 AS [Set], G12 AS [Value] FROM [tblMetod];
_ _ _ _
SELECT Q1.IDSE, Q1.TheDay, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, Q1.TheDay;
is it correct ?
thx


"John Spencer" wrote
You need to go back the Union query and add in the date field to all
parts of the union query. Then the fiedl will be available in the query
based on the union query. Also, I should have prefaced the field name
with the query alias.

SELECT Q1.IDSE
, Q1.TheDay
, Count(*) as Matches
FROM ...


"John Spencer" wrote
Is "theDay" a field in the table?

yes, it's data field in tblMetod
Is it always the same value for each IDSE
every id have a different data ex id 1 10/04/06, 2 11/04/06...

value (a one to one match)?

If it is a one to one match then
the matches don't count data field but other field of table

SELECT Q1.IDSE
, TheDay
, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE = Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value]) AND
((Q1.IDSE)>=335))
GROUP BY Q1.IDSE, TheDay;

this query is based on an other query UnQryMetod ,
SELECT IDSE, 1 AS [Set], Es1 AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 1 AS [Set], Es2 AS [Value] FROM [tblMetod]
UNION
.........

SELECT IDSE, 2 AS [Set], CO AS [Value] FROM [tblMetod]
UNION
SELECT IDSE, 2 AS [Set], G1 AS [Value] FROM [tblMetod]
.......

UNION SELECT IDSE, 2 AS [Set], G12 AS [Value] FROM [tblMetod];

UnQryMetod on tblMetod

thx



If TheDay is a calculated value, then how is it calculated?

I have a query like this from tblMetod (IDSE, theday,...)and
UnQryMetod
SELECT Q1.IDSE, Count(*) AS Matches
FROM UnQryMetod AS Q1 INNER JOIN UnQryMetod AS Q2 ON Q1.IDSE =
Q2.IDSE
WHERE (((Q1.Set)=1) AND ((Q2.Set)=2) AND ((Q1.Value)=[Q2].[Value])
AND
((Q1.IDSuperE)>=335))
GROUP BY Q1.IDSE;
ex the result are:
ResultMetod IDSE Matches
336 1
337 2
338 2

Is it possible to have a field data too?
IDSE theday Matches
336 10/04/2006 1
337 11/04/2006 2
338 12/04/2006 2


thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top