![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
hello. I'm able to exclude all the records where type is not "T", but if I found type ="T", that contr goes into results because of the ID field... |
|
any idea of how I can do this ? thanks in advance p.s.sorry for my english, I'm Italian. I really hope you can understand me... |
#3
| |||
| |||
|
|
Please post the query that you have used. |
#4
| |||
| |||
|
|
On 5 Apr, 10:09, Henk van den Berg<hvandenb... (AT) xs4all (DOT) nl> wrote: Please post the query that you have used. SELECT contr FROM table1 WHERE (contr NOT IN (SELECT contr FROM table1 WHERE (type = 'T') GROUP BY contr) In my idea this should be ok, but when I double-check the results, something goes wrong... no idea why |
#5
| |||
| |||
|
|
Forgot to ask the following, which we need as well: Can you provide us with a CREATE TABLE script and a INSERT INTO script? |
#6
| |||
| |||
|
|
On 5 Apr, 10:59, Henk van den Berg<hvandenb... (AT) xs4all (DOT) nl> wrote: Forgot to ask the following, which we need as well: Can you provide us with a CREATE TABLE script and a INSERT INTO script? I'm sorry, I can't... that table is created by a software, and I need to extract some data from a table that is already in place .... suppose that I have that table, with data very similar to those I wrote... |
#7
| |||
| |||
|
|
On 5 Apr, 10:09, Henk van den Berg<hvandenb... (AT) xs4all (DOT) nl> wrote: Please post the query that you have used. SELECT contr FROM table1 WHERE (contr NOT IN (SELECT contr FROM table1 WHERE (type = 'T') GROUP BY contr) In my idea this should be ok, but when I double-check the results, something goes wrong... no idea why |
#8
| |||
| |||
|
|
On 5 Apr, 10:09, Henk van den Berg<hvandenb... (AT) xs4all (DOT) nl> wrote: Please post the query that you have used. In my idea this should be ok, but when I double-check the results, something goes wrong... no idea why |
#9
| |||
| |||
|
|
SELECT contr FROM table1 WHERE (contr NOT IN (SELECT contr FROM table1 WHERE (type = 'T') GROUP BY contr) In my idea this should be ok, but when I double-check the results, something goes wrong... no idea why |
#10
| |||
| |||
|
|
If you SELECT * * contr FROM * * * table1 * WHERE * * (contr *IN * (SELECT * * contr * FROM * * * * *table1 * WHERE * * *(type <> 'T') * GROUP BY contr) you will get the expected results. |
|
SELECT contr FROM table1 WHERE (type <> 'T') |
|
Still, the simple version is preferable SELECT DISTINCT contr FROM table1 WHERE type <> 'T' |
![]() |
| Thread Tools | |
| Display Modes | |
| |