character set problem

2007-02-17 Thread shahrzad khorrami

Hi,
I want to search from a table , I have a table with a column that each
record filled with different character set ,is it possible
to know what are their character set and then is it possible to change all
of them
to a character set ,how can I do that?
these  records show like below that I don't know what are their charset :

ارÚ(c)يد شيمی جهان
توليد

thanks


RE: SQL Translation

2007-02-17 Thread Trimeloni, Adam

Thanks for your feedback.

By the way, I found the following to be the way to go.

Original
> Select * 
> from  group_mstr gm,group_payers gp
> where  gm.practice_id = '1'
> and gp.location_id = '2'
> and gp.practice_id =* gm.practice_id 
> and gp.group_id =* gm.group_id 
> order by gp.payer_id

New:
Select *
>From group_mstr gm
Right outer join grou_payers gp on 
  (  gp.location_id = '2' 
 and gp.practice_id = gm.practice_id 
 and gp.group_id = gm.group_id
   )
Where
  gm.practice_id = '1'



When compared to the suggestions, notice how I had to keep the
qp.location_id in the on portion to keep them equivalent.

Regards,

Adam



Adam Trimeloni
Project Leader
Quality Systems
[EMAIL PROTECTED]
(949) 255-2600
 

-Original Message-
From: Trimeloni, Adam 
Sent: Thursday, February 15, 2007 2:32 PM
To: 'Gary W. Smith'; Dan Nelson
Cc: mysql@lists.mysql.com
Subject: RE: SQL Translation

I should have mentioned it is a short hand for a join.

*= is a left outer join.
=* is a right outer join.



Adam Trimeloni
Project Leader
Quality Systems
[EMAIL PROTECTED]
(949) 255-2600
 

-Original Message-
From: Gary W. Smith [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 15, 2007 2:19 PM
To: Dan Nelson; Trimeloni, Adam
Cc: mysql@lists.mysql.com
Subject: RE: SQL Translation

> > Select *
> > from  group_mstr gm,group_payers gp
> > where  gm.practice_id = '1'
> > and gp.location_id = '2'
> > and gp.practice_id =* gm.practice_id
> > and gp.group_id =* gm.group_id
> > order by gp.payer_id
> 
> I bet =* is shorthand for an outer join (not sure if it's left or
> right).  You should be able to do the same in mysql with

Isn't that the Oracle syntax for join?  I didn't think that was
supported in SQL 2000

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Real BITs which use 1 bit in 5.1?

2007-02-17 Thread Kevin Burton

A little birdie:

http://forge.mysql.com/wiki/Top10SQLPerformanceTips

notes..

"In 5.1 BOOL/BIT NOT NULL type is 1 bit, in previous versions it's 1 byte."

Is this true?

I didn't see a note in the manual..

I assume it would be here

http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html

--
Founder/CEO Tailrank.com
Location: San Francisco, CA
AIM/YIM: sfburtonator
Skype: burtonator
Blog: feedblog.org
Cell: 415-637-8078

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



sum with update

2007-02-17 Thread Ahmad Al-Twaijiry

Hi Everyone

I have a question regarding SUM and Update.

is it possible to use SUM with Update ?

for example I have 3 tables

table_1:
idT1   Price
120
230
350
420

table_2:
idCust   Total  idT1
2   3011 2
2   221   1
4   2   2
3   31 1
2   302   4
2   30 1

table_3:
idCust  Account
2   200
3   19
399


I want to update table_3.Account**IF** (table_3.Account +
SUM(table_2.Total* table_1.Price) ) small than 1000 for each customer
(idCust)

is this possible using only SQL or I have to do it in programming ?


Thanks
--
echo "Hello World :)"


Re: Temporary table lifespan - SOLVED

2007-02-17 Thread Amer Neely

Jerry Schwartz wrote:

Possibly you are opening another connection, using the same handle, when you
re-enter your script. If that is the case, you'll lose track of your
previous connection (the one that has the temporary table). You might also
be accumulating a lot of connections, if this recursion happens multiple
levels.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341



-Original Message-
From: Amer Neely [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 11:21 PM
To: Daniel Kasak; mysql@lists.mysql.com
Subject: Re: Temporary table lifespan - SOLVED

Amer Neely wrote:

Daniel Kasak wrote:

Amer Neely wrote:


OK, that makes sense. As far as I know, my connection is

still live

- I don't do a disconnect anywhere. So I'm still not sure why I
can't pull the data back out. I do get an error telling

me about a

problem with my statement near  which is where it tries to
execute the FROM command.
My apologies, I'm not on the computer that I am developing this
script on, so can't give you the exact error.

I'm naming the table from a purchase order number, and

as far as I

can tell, the table I try to read from is the same as the one I
created - but I get nothing out of it.

It's hard to say without more details. You can send the

script if you

want. Also keep in mind that since you're using tmp tables

which are

invisible to all other connections, you don't need to much

around with

creating a unique table name - you can just use a generic one ( eg
tmp_purchase_order or something ).


I'll try something like that tomorrow. Thanks for the

responses. I'll

post my results.


After failing to get the temporary table method working, I
ended up just
creating a table, then dropping it when I was done.

It seems that a temporary table will get deleted when a script calls
itself and jumps to a function inside. That must constitute a
disconnection.


I checked my code, and one of the first things the script does is 
connect to the database. So you're right, it starts a new connection. I 
couldn't figure an easy way around that - kind of like the horse / cart 
thingy, so went the route I did with just dropping a table after 
processing. Works fine.

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
v: 705.223.3539
Perl | MySQL programming for all data entry forms.
"We make web sites work!"

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



SELECT single row from 2 tables with WHERE clause

2007-02-17 Thread Kerry Frater
I am trying to select a particular row from a table and include a column for
aq second table but I cannot get the result I am after.

I have "table1" with 1000 rows and "table2" with 12 rows. The relationship
between the tables is a column "linkedfield". Table1 has a unique key called
"lookup"

If I use the code
SELECT t1.*,t2.thedescription AS t2desc FROM table1 AS t1, table2 AS t2
where (t1.lookup='Z')
I get a result of 12 rows (as expected)

SELECT t1.*,t2.thedescription AS t2desc FROM table1 AS t1, table2 AS t2
where (t1.linkfield=t2.linkfield)
I get 1000 rows as expected

SELECT t1.*,t2.thedescription AS t2desc FROM table1 AS t1, table2 AS t2
where (t1.lookup='Z') and (t1.linkfield=t2.linkfield)
returns 1 row if there is an active link between the two tables and

returns 0 rows if there isn't.

This is where I am stuck. In the last example I would like the 1 row whether
there is an "active" link or not. The difference will be simply that the
"t2desc" rsulting column will be blank or contain a value.

Can anyone help me with the logic?

Kerry


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]