Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select distinct ab.school_name_unicode from `stipend_info_10_11JulDis_2Jul_1` ab where (ab.school_name = 'Bashgari () Sarkari Prathmik Bidjalay' or ab.school_name = 'Bashgari Sarkari Prathmik Bidjalay');
- -- today 03-07-2016
- SELECT ab.total_amount AS tot, COUNT(*) AS total, ab.school FROM
- (SELECT
- SUM(s.`amount`) AS total_amount,
- s.`school_name_unicode` AS school
- FROM
- `stipend_info_02072016` s
- INNER JOIN `student` t
- ON s.`id` = t.`stipend_info_id`
- WHERE -- s.mobile_flag=0
- -- AND s.`amount_flag` = 0
- flag = 0
- AND s.amount IS NOT NULL
- GROUP BY s.`mobile_number`,
- s.`parent_name`
- ) ab
- GROUP BY ab.total_amount, ab.school
- HAVING tot = 600 OR tot = 1200
- ORDER BY ab.school,total DESC;
- select * from
- `stipend_info_02072016` s
- INNER JOIN `student` t
- ON s.`id` = t.`stipend_info_id`;
- select s.thana_name, s.thana_name_original, s.thana_name_unicode from
- `stipend_info_02072016` s
- where school_name_unicode = 'আটঘেরা সরকারি প্রাথমিক বিদ্যালয়';
- SELECT ab.total_amount AS tot, COUNT(*) AS total, ab.school, ab.thana, ab.district FROM
- (SELECT
- SUM(s.`amount`) AS total_amount,
- s.`school_name_unicode` AS school, s.thana_name_unicode as thana, s.district_original as district
- FROM
- `stipend_info_02072016` s
- INNER JOIN `student` t
- ON s.`id` = t.`stipend_info_id`
- where flag = 0
- AND s.amount IS NOT NULL
- GROUP BY s.`mobile_number`
- -- ,
- -- s.`parent_name_modified`
- ) ab
- GROUP BY ab.total_amount, ab.school
- HAVING tot = 600 OR tot = 1200
- ORDER BY ab.school,total DESC;
- ////////////////////////////
- select * from `stipend_info_10_11JulDis_2Jul_1`;
- select count(*) from `stipend_info_10_11JulDis_2Jul_1` t
- group by t.parent_name_unicode, t.nationalidoriginal;
- select count(distinct t.mobile_number) validMobileCount, Group_Concat(distinct t.mobile_number separator ', ') from `stipend_info_10_11JulDis_2Jul_1` t
- where
- (
- (SUBSTR(t.`mobile_number`,1,3) IN ('017','016','015','019','018','011') AND LENGTH(t.`mobile_number`) = 11)
- OR
- (SUBSTR(t.`mobile_number`,1,2) IN ('17','16','15','19','18','11') AND LENGTH(t.`mobile_number`) = 10)
- )
- group by t.parent_name_unicode, t.nationalidoriginal
- order by validMobileCount desc;
- SELECT
- f.parent_name_unicode,
- f.nationalidoriginal,
- f.mobile_number,
- s.mobile_number
- FROM
- `stipend_info_10JulDisb_1Jul-1` f
- INNER JOIN
- `stipend_info_10JulDisb_1Jul-1` s ON f.parent_name_unicode = s.parent_name_unicode
- AND f.nationalidoriginal = s.nationalidoriginal
- INNER JOIN
- (SELECT
- COUNT(DISTINCT t.mobile_number) validMobileCount,
- t.mobile_number
- FROM
- `stipend_info_10JulDisb_1Jul-1` t
- WHERE
- ((SUBSTR(t.`mobile_number`, 1, 3) IN ('017' , '016', '015', '019', '018', '011')
- AND LENGTH(t.`mobile_number`) = 11)
- OR (SUBSTR(t.`mobile_number`, 1, 2) IN ('17' , '16', '15', '19', '18', '11')
- AND LENGTH(t.`mobile_number`) = 10))
- GROUP BY t.parent_name_unicode , t.nationalidoriginal) t ON f.mobile_number = t.mobile_number
- WHERE
- f.mobile_number != s.mobile_number
- AND f.nationalidoriginal != 'Null'
- AND ((SUBSTR(f.`mobile_number`, 1, 3) IN ('017' , '016', '015', '019', '018', '011')
- AND LENGTH(f.`mobile_number`) = 11)
- OR (SUBSTR(f.`mobile_number`, 1, 2) IN ('17' , '16', '15', '19', '18', '11')
- AND LENGTH(f.`mobile_number`) = 10))
- AND NOT ((SUBSTR(s.`mobile_number`, 1, 3) IN ('017' , '016', '015', '019', '018', '011')
- AND LENGTH(s.`mobile_number`) = 11)
- OR (SUBSTR(s.`mobile_number`, 1, 2) IN ('17' , '16', '15', '19', '18', '11')
- AND LENGTH(s.`mobile_number`) = 10));
- UPDATE
- `stipend_info_10JulDisb_1Jul-1` f
- INNER JOIN
- `stipend_info_10JulDisb_1Jul-1` s ON f.parent_name_unicode = s.parent_name_unicode
- AND f.nationalidoriginal = s.nationalidoriginal
- INNER JOIN
- (SELECT
- COUNT(DISTINCT t.mobile_number) validMobileCount,
- t.mobile_number
- FROM
- `stipend_info_10JulDisb_1Jul-1` t
- WHERE
- ((SUBSTR(t.`mobile_number`, 1, 3) IN ('017' , '016', '015', '019', '018', '011')
- AND LENGTH(t.`mobile_number`) = 11)
- OR (SUBSTR(t.`mobile_number`, 1, 2) IN ('17' , '16', '15', '19', '18', '11')
- AND LENGTH(t.`mobile_number`) = 10))
- GROUP BY t.parent_name_unicode , t.nationalidoriginal) t ON f.mobile_number = t.mobile_number
- set s.mobile_number = f.mobile_number
- WHERE
- f.mobile_number != s.mobile_number
- AND f.nationalidoriginal != 'Null'
- AND ((SUBSTR(f.`mobile_number`, 1, 3) IN ('017' , '016', '015', '019', '018', '011')
- AND LENGTH(f.`mobile_number`) = 11)
- OR (SUBSTR(f.`mobile_number`, 1, 2) IN ('17' , '16', '15', '19', '18', '11')
- AND LENGTH(f.`mobile_number`) = 10))
- AND NOT ((SUBSTR(s.`mobile_number`, 1, 3) IN ('017' , '016', '015', '019', '018', '011')
- AND LENGTH(s.`mobile_number`) = 11)
- OR (SUBSTR(s.`mobile_number`, 1, 2) IN ('17' , '16', '15', '19', '18', '11')
- AND LENGTH(s.`mobile_number`) = 10));
- ///////////////////////
- select ab.mobile_number, ab.Amount as amount, count(*) as COUNT, Group_Concat(ab.beneficiary separator ','), ab.school_name_unicode
- from
- (
- SELECT
- s.`parent_name_unicode` AS beneficiary,
- s.mobile_number,
- SUM(s.`amount`) AS Amount,
- s.`school_name_unicode`,
- s.school_name
- FROM
- `stipend_info_10JulDisb_1Jul-1` s
- INNER JOIN `student_10JulDisb_1Jul-1` t
- ON s.`id` = t.`stipend_info_id`
- WHERE s.mobile_flag=0
- AND s.amount IS NOT NULL
- GROUP BY s.`mobile_number`,
- s.`parent_name_bijoy`, s.school_name_original
- HAVING Amount > 0
- ) ab
- where (ab.school_name = 'Bashgari () Sarkari Prathmik Bidjalay' or ab.school_name = 'Bashgari Sarkari Prathmik Bidjalay')
- group by ab.mobile_number, amount
- having count> 1
- order by ab.school_name,ab.mobile_number,amount,COUNT desc;
- select ab.mobile_number, ab.Amount as amount, count(*) as COUNT, Group_Concat(ab.beneficiary separator ','), ab.school_name_unicode
- from
- (
- SELECT
- s.`parent_name_unicode` AS beneficiary,
- s.mobile_number,
- SUM(s.`amount`) AS Amount,
- s.`school_name_unicode`,
- s.school_name
- FROM
- `stipend_info_10JulDisb_1Jul-1` s
- INNER JOIN `student_10JulDisb_1Jul-1` t
- ON s.`id` = t.`stipend_info_id`
- WHERE s.mobile_flag=0
- AND s.amount IS NOT NULL
- GROUP BY s.`mobile_number`,
- s.`parent_name_bijoy`, s.school_name_original
- HAVING Amount > 0
- ) ab
- where ab.school_name = 'Bashgari Sarkari Prathmik Bidjalay'
- group by ab.mobile_number, amount
- having amount=600 and count> 1
- order by ab.school_name,ab.mobile_number,amount,COUNT desc;
- select * from `stipend_info_10JulDisb_1Jul-1` t join `student_10JulDisb_1Jul-1` s on t.id = s.stipend_info_id where t.mobile_number = '01718962780'
- //////////////////////
- SELECT
- SUM(s.`amount`) AS total_amount,
- s.`school_name_unicode` AS school
- FROM
- `stipend_info_02072016` s
- INNER JOIN `student` t
- ON s.`id` = t.`stipend_info_id`
- -- WHERE s.mobile_flag=0
- -- AND s.`amount_flag` = 0
- -- AND s.amount IS NOT NULL
- where flag = 0
- GROUP BY s.`mobile_number`,
- s.`parent_name`;
- ////////////////////////
- SELECT
- s.`token_no`,
- s.`parent_name_bijoy` AS beneficiary,
- s.`customer_wallet`,
- GROUP_CONCAT(DISTINCT t.student_name_original SEPARATOR ',') AS Students_name,
- SUM(s.`amount`) AS Amount,
- GROUP_CONCAT(t.`class_name_orginal` SEPARATOR ',') AS classes,
- COUNT(
- DISTINCT t.`student_name_original`
- ) AS total,
- s.`school_name_original`
- FROM
- stipend_info_02072016 s
- INNER JOIN `student` t
- ON s.`id` = t.`stipend_info_id`
- WHERE -- s.mobile_flag=0 and
- s.school_name_unicode = 'আজিমপুর সরকারি প্রাথমিক বিদ্যালয়'
- -- AND s.`amount_flag` = 0
- AND s.amount IS NOT NULL
- and flag = 0
- GROUP BY s.`mobile_number`,
- s.`parent_name_bijoy`
- ORDER BY s.`school_name_original`,s.`token_no` ASC;
- //////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement