Skip to content

Instantly share code, notes, and snippets.

@bcmiller
Created March 28, 2012 17:38
Show Gist options
  • Save bcmiller/2228534 to your computer and use it in GitHub Desktop.
Save bcmiller/2228534 to your computer and use it in GitHub Desktop.
Prod:
mysql> select distinct (field_user_gender_value) from content_field_user_gender;+-------------------------+
| field_user_gender_value |
+-------------------------+
| 1 |
| 2 |
+-------------------------+
2 rows in set (0.51 sec)
PDUP:
mysql> select distinct (field_user_gender_value) from content_field_user_gender;+-------------------------+
| field_user_gender_value |
+-------------------------+
| 1 |
| 2 |
| 0 |
| NULL |
+-------------------------+
mysql> select count(*),field_user_gender_value from content_field_user_gender group by field_user_gender_value;
+----------+-------------------------+
| count(*) | field_user_gender_value |
+----------+-------------------------+
| 1 | NULL |
| 17 | 0 |
| 44595 | 1 |
| 51436 | 2 |
+----------+-------------------------+
4 rows in set (1.95 sec)
also db allows NULL for this field and should not:
mysql> desc content_field_user_gender;
+-------------------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------------+------------------+------+-----+---------+-------+
| vid | int(10) unsigned | NO | PRI | 0 | |
| nid | int(10) unsigned | NO | MUL | 0 | |
| field_user_gender_value | longtext | YES | | NULL | |
+-------------------------+------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
PROD:
mysql> select * from content_node_field where field_name like '%gender';
+-------------------+------+----------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+------------+--------+---------------------------------------------------------------------------------------------------------------------------+--------+--------+
| field_name | type | global_settings | required | multiple | db_storage | module | db_columns | active | locked |
+-------------------+------+----------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+------------+--------+---------------------------------------------------------------------------------------------------------------------------+--------+--------+
| field_user_gender | text | a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:21:"|--
1|Male
2|Female";s:18:"allowed_values_php";s:0:"";} | 1 | 0 | 0 | text | a:1:{s:5:"value";a:5:{s:4:"type";s:4:"text";s:4:"size";s:3:"big";s:8:"not null";b:0;s:8:"sortable";b:1;s:5:"views";b:1;}} | 1 | 0 |
+-------------------+------+----------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+------------+--------+---------------------------------------------------------------------------------------------------------------------------+--------+--------+
1 row in set (0.00 sec)
mysql>
PDUP:
mysql> select * from content_node_field where field_name like '%gender';
+-------------------+------+----------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+------------+--------+---------------------------------------------------------------------------------------------------------------------------+--------+--------+
| field_name | type | global_settings | required | multiple | db_storage | module | db_columns | active | locked |
+-------------------+------+----------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+------------+--------+---------------------------------------------------------------------------------------------------------------------------+--------+--------+
| field_user_gender | text | a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:15:"1|Male
2|Female";s:18:"allowed_values_php";s:0:"";} | 1 | 0 | 0 | text | a:1:{s:5:"value";a:5:{s:4:"type";s:4:"text";s:4:"size";s:3:"big";s:8:"not null";b:0;s:8:"sortable";b:1;s:5:"views";b:1;}} | 1 | 0 |
+-------------------+------+----------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+------------+--------+---------------------------------------------------------------------------------------------------------------------------+--------+--------+
1 row in set (0.00 sec)
prod:
mysql> select global_settings,hex(global_settings) from content_node_field where field_name like '%gender';
+----------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| global_settings | hex(global_settings) |
+----------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:21:"|--
1|Male
2|Female";s:18:"allowed_values_php";s:0:"";} | 613A343A7B733A31353A22746578745F70726F63657373696E67223B733A313A2230223B733A31303A226D61785F6C656E677468223B733A303A22223B733A31343A22616C6C6F7765645F76616C756573223B733A32313A227C2D2D0D0A317C4D616C650D0A327C46656D616C65223B733A31383A22616C6C6F7765645F76616C7565735F706870223B733A303A22223B7D |
+----------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
pdup:
mysql> select global_settings,hex(global_settings) from content_node_field where field_name like '%gender';
+----------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| global_settings | hex(global_settings) |
+----------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:15:"1|Male
2|Female";s:18:"allowed_values_php";s:0:"";} | 613A343A7B733A31353A22746578745F70726F63657373696E67223B733A313A2230223B733A31303A226D61785F6C656E677468223B733A303A22223B733A31343A22616C6C6F7765645F76616C756573223B733A31353A22317C4D616C650A327C46656D616C65223B733A31383A22616C6C6F7765645F76616C7565735F706870223B733A303A22223B7D |
+----------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select node.nid,users.name,users.mail,node.uid from content_field_user_gender,node, users where field_user_gender_value=0 and node.nid=content_field_user_gender.nid and users.uid=node.uid;
+---------+---------------------------+---------------------------------------+--------+
| nid | name | mail | uid |
+---------+---------------------------+---------------------------------------+--------+
| 13005 | bill | [email protected] | 9825 |
| 2613248 | donaldduck | [email protected] | 994328 |
| 2613308 | number434293434 | [email protected] | 994338 |
| 2613418 | number1826622181 | [email protected] | 994378 |
| 2613448 | number791165951 | [email protected] | 994388 |
| 2613488 | number1_1 | [email protected] | 994398 |
| 2613688 | number535033062 | [email protected] | 994468 |
| 2613848 | number666960102 | [email protected] | 994518 |
| 2613858 | btvs | [email protected] | 994528 |
| 2613978 | johnjohn | [email protected] | 994568 |
| 2614148 | webform | [email protected] | 994588 |
| 2614528 | bob_7 | [email protected] | 994728 |
| 2614568 | number1902747781 | [email protected] | 994758 |
| 2614808 | number1271171584 | [email protected] | 994818 |
| 2614848 | number373511400 | [email protected] | 994848 |
| 2614978 | number1408148293 | [email protected] | 994868 |
| 2614998 | number989022408 | [email protected] | 994878 |
| 2615038 | wouldyoucouldyouinthedark | [email protected] | 994888 |
| 2615078 | chicagokiller | [email protected] | 994908 |
+---------+---------------------------+---------------------------------------+--------+
19 rows in set (0.12 sec)
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment