howdy
Is this problem not roaring for herd of lex, yacc, flex, gnus, bison?
Also Aho and Sethi might be involved
krs,
tesu
howdy
Is this problem not roaring for herd of lex, yacc, flex, gnus, bison?
Also Aho and Sethi might be involved
krs,
tesu
Hello
... "There are 20 types of rating with numerical value ( in look up table)"
How is rating related to numerical value(s) ? Something like this:
AAA 20.5
AA 5.5
or even like this:
AAA 20.5
AAA 30
AAA -1 etc ?
krs,
tesu
p.s.
I have got the feeling that there could be something wrong between Supplier( supplierid, supplier) and Suppliertype( suppliertypeid, supplierid, typesof products)
If you want to express that: One supplier supplies various types of products and on type of product is supplied by various suppliers there exists a many-to-many relationship between suppliers and producttypes. Therefore the "linking" table contains primary key from supplier table and primary key of table producttypes. Both primary keys form the primary key of your so called "Suppliertype" table. They must also be foreign keys in that table. Sure, there can be additional data in the linking table, sometimes even an third attribute can be part of its primary key. So the create-table statement for Suppliertype would look like:
create table Suppliertype(supplierID integer not null, producttypesID integer not null,
maybe_additional_data varchar(50), primary key (supplierID, producttypesID),
foreign key (supplierID) references suppliers,
foreign key (producttypesID) references producttypes);
btw, if you omit the word "types" in "...of these different types of product...", what then means that a supplier supplies various (real) products and a (real) product would be supplied by various supplier, the many-to-many relationship will …
Hi again,
well, I have got some problems understanding your screen shots. Wouldn't it be easier you post your sql code for tables and view creations? I know, if select statements are getting more and more complex, creating views or stored procedure is obviously an appropriate vehicle to get some provisional results where further results might be drawn from. Do you ever thought of using WITH clause?
Maybe I will be able to give you further advice when I would have seen the create-view and create-tables code.
krs,
tesu
Hello,
unfortunately and opposite to other database vendors, mysql does not publish a meaningful list of all error numbers or even warnings, they only explain some errors here and there. So one cannot found an explanation of "error" -1 what seems to be a negative SQLCODE (unfortunately there isn't an official standardized SQLCODE -1). Anyway, there are various reasons for such error:
You must have execute privilege if you want to execute procedure or function.
Are you owner of those tables, did you create them?
Are there any foreign keys related to one or both tables?
Maybe your tables are still locked? For example you have just inserted some data and auto commit is off then you would not allow to delete them. To unlock tables enter commit.
Ah, what version of mysql are you working with? You must have version 5.0.1 and up, eventually check proc table whether it exists.
Last but not least, the body of stored procedure is clasped by BEGIN .... END ; <--- ends with semicolon.
krs,
tesu
In
INSERT INTO dudel2 SELECT name, sex, age FROM dudel GROUP BY name, sex, age;
GROUP BY clause, which must contain all attributes (column names), provides for distinct rows too.
Instead of GROUP BY clause you can also use DISTINCT:
INSERT INTO dudel2 SELECT DISTINCT name, sex, age FROM dudel;
Both insert statements are equivalent but yours is simpler :)
We shall wait for cmhampton to see his solution for sql server 2005. Anyway, if you are working with server 2000, he should post his solution.
krs,
tesu
Hi,
obviously both is possible as you can read on http://www.microsoft.com/technet/prodtechnol/sql/2005/technologies/dbm_best_pract.mspx
Database mirroring maintains a hot standby database (known as the mirror database) that can quickly assume client connections in the event of a principal database outage. Database mirroring involves two copies of a single database that reside on different computers. At any given time, only one copy of the database is available to clients. This copy is known as the principal database. Unlike log shipping which works by applying full transaction log backups to a warm standby database, database mirroring works by transferring and applying a stream of database log records from the principal database to the other copy of the database (the mirror database). Database mirroring applies every database modification that is made on the principal database to the mirror database. This includes data changes as well as changes to the physical and logical structures in the database, such as database files, tables, and indexes.
You should consider that database mirroring has been supported since sql server 2005, SP1.
All server (principal, mirror, witness) must be correctly set up and configured.
happy mirroring :)
krs,
tesu
Hi
This is a very simple standard task you always have to solve, if one-to-many related tables need to get together. Is that not related to your other nice thread, E-commerce data design issue of May 12th, 2008, what is still dangling about?
krs,
tesu
Hi veledrom,
I think your SQL is syntactically not corret: If insert is done from result set given by select you must not use values part. Also, if you want to insert two values you must also select two values in each row. So try this:
INSERT INTO table1 (subid, paid)
SELECT subid, paid FROM def_1 WHERE id IN (SELECT id FROM def_2)
krs,
tesu
Hi monksorlo,
sorry, it has never been my intention to discredit your prof. My given statement sounds kind of sloppy.
Your subtype/supertype is exactly that what I meant with the extension of entity relationship model Generalization/Specialization. Supertype is equivalent to generalization and subtype to specialization.
As for your first question, there are several ways to map supertype/subtype of EERM into SQL of relational model. I will give you the common solution (what is indeed not that high-performance).
Supertype contains all attributes in common of all specializations. So what is in common of both manufactured and purchased parts? Obviously part number, name, category, Dimensions like weight etc.
Specialized attributes of manufactured parts would be the material the part is made from, equipment (what s that?), etc. Purchased parts is specizfied by supplier, price, delivery time etc. I assume there is only one supplier for a specific part, that is an one-to-many relationship. (If there are various supplier for same part and a specific supplier supplies various parts you would have a many-to-many relationship. If so, you must create a linking table what links purchased parts and supplier). Now we can create tables and their relationships:
-- supertype parts
create table parts(partnumber integer not null, name varchar(100), category char(10), weight decimal(10,2), primary key (partnumber));
-- subtypes, there can only be one-to-one relationship between supertype and subtypes (except you allow that a specific part can be both manufatured and purchased, sometimes)
-- -- subtype …
Oh, Lady Be Good :twisted:
Hi tuse
How are you?
Thanks a lot.
Didn't see the 'mysql' database.
Well, if you had access to grant table mysql.user you would have also been able to
SELECT User, Password FROM mysql.user. You got it? Yes, you would be able to hack that
mysql database. So it's a good idea that not everybody is allowed to "see" grant table.
Happy hacking !
krs,
tesu
Hi
You may also consider SQL Anywhere and SQL UltraLight from Sybase, exceptional worldwide market leader in mobile computing.
krs,
tesu
Hello michael123
I am afraid, there is no direct way to get rid of duplicate rows.
But you can populate a new table with distinct rows from your given table only, for example:
-- create your table
create table dudel(name varchar(50)not null, sex char(1), age integer);
-- inserte some rows into dudel
insert into dudel (name, sex, age) values ('Randy', 'M', 66);
-- . . .
commit;
-- Show all rows of dudel
select name, sex, age from dudel;
/*
name,sex,age
----------------
'mike','M',60
'mike','M',60
'mike','M',60
'Randy','M',66
'Randy','M',66
'Randy','M',66
'Randy','M',66
*/
-- show only distinct rows
select name, sex, age from dudel group by name, sex, age;
/*
name,sex,age
------------
'mike','M',60
'Randy','M',66
*/
-- create a new table dudel2 (clone of dudel)
create table dudel2(name varchar(50)not null, sex char(1), age integer);
-- populate dudel2 from dudel leaving out all duplicates
insert into dudel2 select name, sex, age from dudel group by name, sex, age;
-- show the result
select name, sex, age from dudel2;
/*
name,sex,age
'mike','M',60
'Randy','M',66
*/
Now you should be able to replace old table by new one containing distinct rows only.
You have to consider foreign keys carefully!
To supply you with more specific solution I need further details on the table in question, especially primary and foreign keys, constraints etc.
krs,
tesu
Is it possible to have Netbeans set up for Cygwin and for Borland 5 free compiler then let me choose a compiler for each project?
This is also what I am looking for. Unfortunately, NetBeans 6.1 seems to have some errors because tutorials from version 6.0 don't run, also not able to assign gcc compilers. It is said that there would be a new patch issued past week. I will test it, especially if it allows to add gcc compilers. You will get then further information by myself.
Btw, instead of cygwin mingw is shown in Netbeans window where to assign the compilers. There is no Borland compiler shown there.
krs,
tesu
Hello Shaun32887
following is a small class what has been posted by a programming virtuoso here in forum on daniweb.com. Unfortunately, I have not recorded his name.
//
// String passing
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
class Pars
{
public:
double bar ( string line )
{
stringstream ss ( line );
string word;
double x;
int n = 0;
while ( ss >> word )
{
istringstream ins;
ins.str ( word );
ins >> x;
cout << n << " " << x << endl;
n++;
}
return x;
}
};
int main()
{
Pars stri;
string s = "100 1.745329252 0.984807753 -0.173648178 -5.67128182";
cout << "Parsing: "<< s << endl;
stri.bar (s);
return 0;
}
/* Result
Parsing: 100 1.745329252 0.984807753 -0.173648178 -5.67128182
0 100
1 1.74533
2 0.984808
3 -0.173648
4 -5.67128
*/
As for your permutation problem, I will search my collections. If I make a find, I will send you the code.
krs,
tesu
eh, thats the boring way ^.^
No, it's just a tit-for-tat response :icon_mrgreen:
Hi arupa
Let's look at an example: With create table t(c char(10), v varchar(10)) there will be 10 places, e.g. 10 bytes statically allocated for column c. At first, there will be nothing allocated for column v, internally indicated by setting current length of v to 0. If you do insert into t (c,v) values ('Hello', 'World') value of c will be internally stored as 'Hello#####' and v as 'World' plus current lenght 5, (# stands for space char). So values of columns with datatype char(char_length) will be padded by spaces if current length < char_length. varchar datatype only allocates as much memory units (usually bytes) as current length requires. Today, most databases usually convert datatype char() into varchar() automatically if char_length exceeds given lower bound (e.g. 10 chars).
krs,
tesu
. . .
int main()
{
for(int i=0; i<2000; i++)
{
cout<< bitset<3> (unsigned char ( (rand() ) ) <<"\n";
}
return 0;
}
. . .
Hello,
your idea of using <bitset> is completely correct. You only need to make some improvements like in:
int main(){
const int n=3, d=1<<n;
for (int i=0;i<2000;i++)cout<<bitset<n>(rand()%d)<<endl;
return 0;
}
/* Result
001
011
001
011
011
110
011
100
111
...
*/
Isn't this a whole lot simpler than that queer one, eh? :D
krs,
tesu
Well, I can do but don't like to do that. Why not reacting to my suggestions first? Also, if one gets at least 100 errors, wouldn't it be great to post some of them?
krs,
tesu
Hi again
I have understood you completely. You may study ERP systems (Enterprise Resource Planning) how they handle such problem of separating various customers strictly. There are famous ERP from Oracle and SAP. I myself do database design and programming on the field of SAP R/3 (has over 17000 tables). No matter how many various customers and their associated enterprise information is managed with R/3 customers etc are all stored in ONE table (there are companies currently having stored over five millions customers in one r/3 table). You can also adopt ERP system concept of client-capable software: Each table out of the 17000 tables has an additional field called client number what is integral part of the primary key. Also every where clause contains that client number. You should consider that being client-capable is a very important feature of ERP systems.
I would never sacrifice the great advantage of having only one set of relational tables for various businesses for the cursory benefit of saving just a where clause.
krs,
tesu
Hi monksorlo
what do you mean by subtype/supertype. Does this deal with the concept of Generalization/Specialization of extended entity relationship model? you may state an example.
If your professor suggest doing something else just for performance reasons at that very early design stage, you may change professors.
krs,
tesu
What's your specific problem, any error messages? did you create all needed handles (SQL_HANDLE_ENV, SQL_HANDLE_DBC, SQL_HANDLE_STMD) properly. did you figure out correct connection string for SQL Server? Every function from ODBC interface returns a value what you may check against SQL_SUCCESS. Did you set up your data source properly? You know, that you can configure a data source, for example DSN, that a very detailed log file will be written, what contains a description of every error happened during connection, sql execution etc. You can post your c++ code showing db connection, connection string, open, sql operations etc.
krs,
tesu
Hi Devin
This is quite a poor idea of designing data models. You will never be able to create good SQL select statements. As you already mentioned, creating and handling stored procedures obviously dwindles into complex task. How do you want to compare data of different customers which are stored in various databases (not tables), ever tried to connect to, say 10 or more databases simultaneously?? In such datamodel, virtually all needed SQL statements must be dynamically generated at runtime. That's rather circumstantially.
Better way would be designing relational data by means of Codd's nomalization theory, applying your tables with proper primary and foreign keys to assure unique records and referential data integrity. Then you will have only ONE customer and only ONE vehicle table. Customer would be identified by a customer ident, what might be generated automatically by database system. If a customer has zero to many vehicles, simple add customerID to vehicles and make it part of vehicle's primary key. The creating statements would then look like:
create table customer (customerID integer not null,
name varchar(100) not null,
address varchar(50), primary key (customerID));
create table vehicle (vehiclesID integer not null,
customerID integer not null, brand varchar(50) not null,
primary key (vehiclesID, customerID),
foreign key (customerID) references customer);
On that simple data model it's absolutely easy to find all customer living in New York an their vehicles, for example:
Select name, brand from customer join vehicle where address like '%New York%'
If you want to …
Hi tkotey
Similar problem we have discussed on http://www.daniweb.com/forums/thread127644.html.
you may investigate SQL code from posts #5 and #7 where I gave solutions on how to compute balance values from consecutive rows. You can adapt that code so it fits your specific requirements. If you have further problems we can discuss them here.
krs,
tesu
instead of: int i = ch; // stores same code in an int (wrongly)
you might try: int*i =(int*)ch;
then
cin>>ch; // enter A for example
cout << ch; // gives A
cout << i; // gives 0x41
cout << (int)i; // gives 65
krs,
tesu
hi,
this could be a solution:
select SUM (Column A) AS TotalColumnA, SUM (Column B) AS TotalColumnB,
TotalColumnA / TotalColumnB as TotalColumnC from yourTable;
If you want to select further columns, for example ColumnX together with results from aggregate functions, you need group by clause:
select ColumnX, SUM (ColumnA) AS TotalColumnA, SUM (ColumnB)
AS TotalColumnB, TotalColumnA / TotalColumnB as TotalColumnC
from yourTable group by ColumnX;
Maybe you post your complete SQL select statement, also view definition, possibly I might then be able to give better advice.
krs,
tesu
... and I want to search on the beginning only ...
Can you give an examle?
Do you know wildcards % and _ ?
krs,
tesu
Hi,
Any one can help me .. i want the C++ code for hashing operations to implement dictionary ADT....Plz help me ...
Thank you
???????????
What do you want to do?
krs,
tesu
Hi tmarket
Did you already tried this sort of inner join:
select r.title from ranges r, ips s
where r.start <= s.ip and sr.ip <= r.stop
Additionally, you should put indexes on s.ip and (r.start, r.stop), e.g.
CREATE INDEX uniqueIndexName on ranges(start, stop), both indexes in ascending order.
krs,
tesu
p.s. As you may know, your sort of inner join is a so called theta-join, and this sort of joins is well known to be the slowest join one can create. (And you are using two of them)
Hi
Your code:
char ch;
int i = ch;
You didn't assign a value to ch. So i is undefined. Also this would not work if you do cin >> ch.
You may try this instead:
char xxx = 'x';
cout << "char: " << xxx << " as int: " << (int) xxx << endl;
cout << "next char: " << ++xxx << " as next int: " << (int) xxx << endl;
If you know pointers, there would also be a solution.
crs,
tesu
Hi all,
I'm trying to design a database model for some ancient poetry books. Here are more information:
- Each verse of book will be a recorded into database. This is critically important since I need to have different feature for each verse. For example, being able to put comment per user, translation, highlighting per user, commentary for organizations per verse and etc.
- I divided books into the following categories:
Book --> Book table
Volume --> Volume table: If a book has more than one volume, this table will be consulted
paragraph --> paragraph table: List of paragraph in each volume/table
verse --> verse table: Each verse is comprised of two line. (mesra1 and mesra2). verse_no is the order number of each verse in paragraph and verse_id is the unique primary key.
Comment is per user comment for each verse and commentary is for organizations- Database is MySQL v5.x
- See attached DB schema file for more information.And here are my questions/dilemma:
- My paragraph table is not fully normalized. I have volume_no and book_id column and not all books have volume. What is the best way to address this issue?
- For each verse's translation, I haven't created a separate table for verse translation and used the same table. The new column is: t_verse_id. If the verse is in source language, this value is 0 and if it's not, this will point to verse_id on the same table. Is this …
You can download SQL management studio separately from MS. It's free.
krs,
tesu
hi
You may try this syntax, what is quite usual in other databases:
SELECT title FROM ranges JOIN ips ON
(
ip BETWEEN start AND stop
)
Question about this create table statement:
CREATE TABLE `ips` (
`ip_id` int(20) unsigned NOT NULL auto_increment,
`ip` int(10) unsigned NOT NULL,
PRIMARY KEY (`ip_id`),
KEY `ip` (`ip`)
) ENGINE=MyISAM;
Does this table really contains duplicate ip numbers (it wouldn't make any sense)? If not, you should delete ip_id and make ip to be the primary key! (It is really badly bad habit always generating artificial primary keys if tables already have enough columns to form their own natural primary keys from.)
krs,
tesu
Hi
What exactly do you mean by:
"This query doesn't work .... mysql server has gone away is the return or nothing... just loading" ?
Do you get any error message?
Does the query never ends?
Is the result set empty? (because of improper data you want to join together. for example: if old_owner of table del2_conquer and id of del2_tribe do not have same values, your result set would be empty.)
How large are both tables, current number of rows per table? Depending on size and features needed sometimes innodb is more useful than myisam.
Second table does not have primary key, also no foreign keys (sorry, fk not possible for myisam). I am trying to figure out which relationship exists between both tables, and I have got the feeling that the table's structure wouldn't that be optimal. As for example villages of del2_tribe could appear several times for same tribe. On the other hand there is villageid of second table, how is it related to first table (via villages)?
ok, maybe above will get you some ideas to proceed solving your problem.
krs,
tesu
Apparently, he is thinking of hacking SQL Server by some C++ code !
Planning this, at least he needs some detailed knowledge about xxxx_getinfo(), . . .
krs,
tesu
p.s. he is kindly invited to post again on database forum.
hey,
you may try recursive function baseb:
void baseb(int b, string fi, unsigned int nb, string &f){
int p = nb % b; nb = nb / b;
if ( nb > 0) baseb(b, fi, nb, f);
f=f+fi[p];
}
int main(){
int b = 16, nb = 2008;
string fi = "0123456789ABCDEF", f = "";
baseb(b, fi, nb, f);
cout << endl;
cout << "Decimal number "<< nb <<" in Base-"<< b << " is "<< f << endl;
// Result: Decimal number 2008 in Base-16 is 7D8
cin.get();
return 0;
}
Now it's your turn to program inverse of function baseb.
krs,
tesu
Elaborate please =], i was trying to say that a-r are random numbers between 1 and 9, this is just a snipet of some code i already have, i an just having some problems with figuring out random numbers... i figured that if the largest variable is an unsigned, max of about 4 billion, and seing as i need a 17 digit number, i generate a number for each digit, when the person continues it prints out each digit in the end
Well dear Superfat, the most effective solution for you problem has already been given by vijayan121. Unfortunately you aren't able to understand his fine function. So GOD's advice should be seriously followed.
Btw, your nice random numbers a..r never contain 9, got it?
krs,
tesu
Well, looking at your short code fragments it seems to be hard to me understanding your problem. I would suggest that you post the really complete (from create procedure... till go)
krs,
tesu
Hello Hairymarble,
1. To all appearance almost every table seems to be already in 3NF, but
2. One cannot state anything about 2NF if no primary keys are given. So to proving 3NF is also impossible.
3. If you have to determine primary keys, you need complete set of functional dependencies. (Then you will be able to figure out primary keys by means of Amstrong axioms.)
4. Because every table lacks of primary key applying foreign keys is impossible. So nobody is able to determine the relationships (cardinalities) between your tables, as for example how is "Dependant" related to "Employee" (I assume this name for that table with PK Employee_Ref). This absence holds for almost every table (except of "Employee" and "Days worked").
You see, your tables need some improvements.
Furthermore, nobody here will agree to do filling out the table of your word document. It s your turn to start for doing this.
btw, what is RDA?
krs,
tesu
Usually Borland c++ Version 5 does not need special configuration after proper installation from original (or even copied) CD, except one tries to install a plain disk copy of an already installed system.
Also samples usually have project files (*.bpr) which must be started instead of a source file belonging to a project. The project file knows all paths of the associated source files (.h, .cpp).
krs,
tesu
Apparently this means a problem with the db design.
But you may freely post your table's schema together with some sample data.
krs,
tesu
thx :zzz:
Here is a great solution of the n queens problem. It originates from Niklaus Wirth, inventor of Pascal, Modula, and Oberon, over 30 years ago. His solution is unique, and I need some hours to understand it completely. Because this code is famous one cannot hand it in as his own solution of an assignment, probably every other teacher knows it.
int nbs=0;
void Queens(int nn, int row[], int k=0)
{ if(k==nn)
{ cout<<endl<<"Solution "<<(++nbs)<<":"<<endl;
for(int i=0; i<nn; i++)
{ for(int j=0; j<nn;j++)
{ if(row[i]==j) cout<<("Q "); else cout<<(". ");
} cout<<endl;} cout<<endl;}
else
{ for(int i=0; i<nn; i++)
{ row[k]=i;
for(int j=0; j<k;j++)
{ if((row[j]==row[k])||((row[j]-row[k])==(k-j))
||((row[k]-row[j])==(k-j))) goto fails;
} Queens(nn, row, k+1); fails:;}}
}
int qu_main(int argc, char *argv[])
{ const int nn = 8;
int *row = new int[nn];
Queens(nn, row);
return 0;
}
Maybe you can learn something from Wirth's code (except from the goto which is considered to be harmful). Interesting is his "chess board" what consists of one row only.
krs,
tesu
sorry, completely nonsense what I wrote ! so forget it.
true, new <--> delete and malloc <--> free
sorry for telling that nonsens
krs,
tesu
Hi mrboolf,
. . .
M_Board::M_Board() { int i = 0, j = 0; m_board = new int*[N]; for(i=0;i<N;i++) { m_board[i] = new int[N]; } i = 0; for(i=0;i<N;i++) { for(j=0;j<N;j++) { m_board[i][j] = 0; } } QCount = 0; } M_Board::~M_Board() { int i = 0; for(i=0;i<N;i++) { delete [] m_board[i]; } delete [] m_board; }
Consider your constructor and destructor:
In C++ memory is allocated by applying "new". Its partner is "free" ! You should never apply "delete", which is plain C, on memory once allocated with "new".
Maybe that will help you.
Btw, you should mark the statements by the line number where the warning appears. So simple add //123: warning: left-hand operand of comma has no effect
at the code line in question.
brs,
tesu
hi
you may try this
int main(int argc, char *argv[]){
cout << "Program name: " << argv[0] << endl;
cout << "Numbers of Parameters: " << argc << endl << "Parameters:\n";
for(int i=1; i<argc;i++) cout << i << " " << argv[i] << endl;
return 0;
}
/* result in console window:
C:\>cara a b c d e f
Program name: cara
Numbers of Parameters: 7
Parameters:
1 a
2 b
3 c
4 d
5 e
6 f
*/
krs,
tesu
One more question, does anyone know how to get Dev C++ to stop deleting the next character space when using space or typing something in? I want it to space over instead of delete and write over.
There is a toggle key on your keyboard labelled 0 INS. If you hit it once, your keyboard will behave as you are asking for, char will be inserted. Hit it twice and your keyboard overwrites next char again.
krs,
tesu
Addition
---------
Based on your given instances ERROR, TESTCYCL, LINK and RUN from post #8
select * from error join link join testcyl join run
gives:
5 open 58778 3971 test 119 failed
6 closed 21122 3971 test 119 failed
7 closed 78944 3971 test 119 failed
(Duplicate columns dropped. I have simplified your naming,
e.g. test instead of TESTCYCL.)
How to compute 7, 2, 5 and 13, 10, 3 etc from the selected data?
Where is the discrepancy?
Hi again,
...
YOUR LAST POST:
I want a query that produces results so that passed and failed add up to the distinct
num affected, so something like:BG_ERROR_ID-- HardwareID-- NumAffected-- Passed-- Failed
----------------------------------------------------------------
5__ 58778__ 7__ 2__ 5
6__ 21122__ 13__ 10__ 3
7__ 78944__ 10__ 9__ 1
. . .YOUR FIRST POST:
A run of this query produces something like:BG_ERROR_ID.....HardwareID.....NumAffected.....Passed.....Failed
----------------------------------------------------------------
286.............87526..........10..............5..........5
226.............82309..........20..............15.........5
233.............17526..........21..............5..........16
586.............23346..........3...............2..........1
555.............87886..........10..............9..........1
200.............27526..........12..............5..........7As you can see, the number of Passed and Failed combined amounts to the NumAffected.
However, what I really need to be doing is a distinct count on NumAffected, i.e.:
Well, in your FIRST POST you said that the result wouldn't meet your conception
(see: "However, what I really need to...")
Your LAST POST shows the same result as your FIRST POST, that is passed+failed mounts up to numaffected. Now you state that this last result would be the result you are looking for. Isn't that a true contradiction? (If last result were correct you would have already found the correct solution as given in your first post!)
I think, before I invest some effort in supporting you to solve your problem you should figure out what you actually want to get from your tables.
krs,
tesu
Hi conwayce,
Sorry about that. I was in a hurrry to post thread. Hope the follwoing makes more sense. Thanks for the quick response.
tableA tableB
Column1 Column1 Column2
Joe Joe apple
Joe Joe orange
Joe Joe peach
Fred Fred potatoe
Fred Fred carrot
Fred Fred apple
Mike Mike carrot
Mike Mike orange
These SQL selects
select a.column1 from tableA a, tableB b
where a.column1 = b.column1 AND b.column2 = 'apple'
-- or with inner join:
select a.column1 from tableA a join tableB b on a.column1 = b.column1
where b.column2 = 'apple'
-- or with key join (if a.column1 and b.column1 are part of primary keys)
select a.column1 from tableA a join tableB b where b.column2 = 'apple'
should give
a.column1
-------------
Joe
Fred
krs,
tesu
p.s. There is no difference between Oracle and MS SQL Server