Home > database >  [with] about the two tables, for the realization of the same field data to heavy
[with] about the two tables, for the realization of the same field data to heavy

Time:09-26


The current business involves two tables
1. The order log tables, including field XZPHONE
2. The activity log table, including field PHONE_NO

CodePudding user response:

1. The first timing task
For the first time I will go to check the order log tables, obtaining normal mobile phone number, call interface activation number, and carry out activities, and will activate the result (success) and the activity to transact the results added to the activity log tables:

2. The second time the task

I will go to the query activity log activation failed cell phone number in the table, to be dealt with again activity



Will there is a question

My mobile number to success in the first access to state and a second access phone number will be repeated for activities, so I'm query a phone number for the first time, to rule out my conduction activity failed mobile number;

CodePudding user response:

Because I activities to deal with mobile phone number has failed another time running, the mobile phone number to deal with failure, but he has successfully, the order status in the table is normal, the first task will be run regularly. I need to rule out the active log the mobile phone number in the table

CodePudding user response:

 SELECT T.X ZPHONE AS PHONENO FROM T_YWXH_LOG T WHERE T.X ZPHONE NOT IN (SELECT T1. PHONE_NO FROM T_YWSK_ACT_LOG T1 WHERE T1. The STATE='1') AND T.S TATE='0' AND T.D SSTATE='0' 


This is my own SQL, although solved, but I feel is not the optimal way, consult everybody

CodePudding user response:

reference Milogenius reply: 3/f
 SELECT T.X ZPHONE AS PHONENO FROM T_YWXH_LOG T WHERE T.X ZPHONE NOT IN (SELECT T1. PHONE_NO FROM T_YWSK_ACT_LOG T1 WHERE T1. The STATE='1') AND T.S TATE='0' AND T.D SSTATE='0' 


This is my own SQL, although solved, but I feel is not the optimal way, consult everybody

There is something wrong with the SQL written,

CodePudding user response:

refer to the second floor Milogenius response:
because I activities to deal with mobile phone number has failed another time running, the mobile phone number to deal with failure, but he has successfully, the order status in the table is normal, the first task will be run regularly. I need to rule out the active log tables in the mobile phone number

You said a long text, it is better to give a SQL result come out,

CodePudding user response:

reference 5 floor springs of water faint reply:
Quote: refer to the second floor Milogenius response:

Because I activities to deal with mobile phone number has failed another time running, the mobile phone number to deal with failure, but he has successfully, the order status in the table is normal, the first task will be run regularly. I need to rule out the active log tables in the mobile phone number

You said a long text, it is better to give a SQL result come out,
great god can help me to write to see? Thank you very much

CodePudding user response:

refer to 6th floor Milogenius response:
Quote: refer to the 5 floor springs of water faint reply:
Quote: refer to the second floor Milogenius response:

Because I activities to deal with mobile phone number has failed another time running, the mobile phone number to deal with failure, but he has successfully, the order status in the table is normal, the first task will be run regularly. I need to rule out the active log tables in the mobile phone number

You said a long text, it is better to give a SQL result come out,
great god can help me to write to see? Thank you very much

Demand is easy to implement, the key is to stick you want results come out,

CodePudding user response:

refer to 7th floor qq646748739 response:
Quote: refer to the sixth floor Milogenius response:

Quote: refer to the 5 floor springs of water faint reply:
Quote: refer to the second floor Milogenius response:

Because I activities to deal with mobile phone number has failed another time running, the mobile phone number to deal with failure, but he has successfully, the order status in the table is normal, the first task will be run regularly. I need to rule out the active log tables in the mobile phone number

You said a long text, it is better to give a SQL result come out,
great god can help me to write to see? Thank you very much

Demand is easy to implement, the key is to stick you want to come out,



Requirements:

Such as order table cell phone number
Number state
1 0
2 0
3 0

Active log table

Number state

1 1
2 1

Now repeat number, check the first table out of the second number 1 and 2, only found out 3

CodePudding user response:

Try this:
[code=sq]
Select a t1. Xzphone
The from t1
Where not the exists (select null from t2 where t2. Phone_no=t1. Xzphone)
[/code]

CodePudding user response:

 
Select a t1. Xzphone
The from t1
Where not the exists (select null from t2 where t2. Phone_no=t1. Xzphone)

CodePudding user response:

Try this SQL:

The SELECT TT. PHONENO1
The FROM (
The SELECT T.X ZPHONE AS PHONENO1,
T1. PHONE_NO AS PHONENO2
The FROM T_YWXH_LOG T
LEFT the JOIN T_YWSK_ACT_LOG T1 on T1. PHONE_NO=T.X ZPHONE
WHERE a T1. STATE='1'
AND T.S TATE='0'
AND T.D SSTATE='0'
) WHERE TT TT. PHONENO2 IS NULL
  • Related