Reply to SQL Query to insert data to a table

Your name:

Reply:


Posted by albertleng on 05/21/07 15:03

Hi all...

Can anyone give clue in doing below?

Let say i have a table A with the following 3 fields. 1)Date
2)Title 3)Status.

i need to insert into table B (also have the same 3 fields) from this
table A with the condition where Title is "Alarm" and Status is "ON".
This can be done by a simple "INSERT" query.

However, there's a case for table A in like below:
Date Title Status
------ ------ ----------
5/7/07 1:05:23am ALARM ON
5/7/07 1:05:24am ALARM ON
5/7/07 1:05:25am ALARM ACK
5/7/07 1:05:25am ALARM ON

Based on the table A above, i only need to insert from table A into
table B the first 2 ALARM(ON)s. The third ALARM(ON) which has the same
Date with ALARM(ACK) needs not to be inserted into table B.

How can i write a simple SQL query which can insert all ALARM(ON)s
which doesnt have same date with ALARM(ACK)?

Thanks. Pls help.

Albert

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация