select

select count and other records in one single query

百般思念 提交于 2020-05-10 07:20:46
问题 I have the following query select main_cat_name,cat_url from mf_main order by main_cat_name This returns whole data of my table.Now i want to have count of the total rows of this table.I can do it using another query but how can i use them in one single query??? I want two data ONE :- the rows of the table TWO:- the count how can i have that in one single query I tried this but it gives correct count but displays only first row of the table : select count(cat_id),main_cat_name,cat_url from mf

select count and other records in one single query

丶灬走出姿态 提交于 2020-05-10 07:20:31
问题 I have the following query select main_cat_name,cat_url from mf_main order by main_cat_name This returns whole data of my table.Now i want to have count of the total rows of this table.I can do it using another query but how can i use them in one single query??? I want two data ONE :- the rows of the table TWO:- the count how can i have that in one single query I tried this but it gives correct count but displays only first row of the table : select count(cat_id),main_cat_name,cat_url from mf

MySQL - SELECT then UPDATE

这一生的挚爱 提交于 2020-05-10 04:06:45
问题 I have a script written in PHP which has this line which is working correctly for selecting the data i need; $result = mysql_query("SELECT product_name, sku, qty FROM supplier_dropship_items WHERE supplier_id = '3' AND status = '2'", $db_beb); What I'm struggling with is a way to update the records I have selected, once selected I need to change the status = '1' so that the next time my script runs it won't pull the same data in the select and will only pull new items in the table which have

MySQL - SELECT then UPDATE

ε祈祈猫儿з 提交于 2020-05-10 04:04:49
问题 I have a script written in PHP which has this line which is working correctly for selecting the data i need; $result = mysql_query("SELECT product_name, sku, qty FROM supplier_dropship_items WHERE supplier_id = '3' AND status = '2'", $db_beb); What I'm struggling with is a way to update the records I have selected, once selected I need to change the status = '1' so that the next time my script runs it won't pull the same data in the select and will only pull new items in the table which have

bash built-in command “select” not work via pipe in shell script

时光总嘲笑我的痴心妄想 提交于 2020-04-21 08:13:16
问题 I wrote a shell script using bash built-in command select to create selection menu. It works well when invoking by bash directly. But if I use pipe | such as cat script.sh | bash , the select function will not work. For example, code snippet shows #!/usr/bin/env bash arr=("Red Hat" "SUSE" "Debian") PS3="Choose distribution:" result=${result:-} select item in "${arr[@]}"; do result="${item}" [[ -n "${result}" ]] && break done echo "Result is ${result}" unset PS3 Directly using bash script.sh ,

bash built-in command “select” not work via pipe in shell script

瘦欲@ 提交于 2020-04-21 08:11:22
问题 I wrote a shell script using bash built-in command select to create selection menu. It works well when invoking by bash directly. But if I use pipe | such as cat script.sh | bash , the select function will not work. For example, code snippet shows #!/usr/bin/env bash arr=("Red Hat" "SUSE" "Debian") PS3="Choose distribution:" result=${result:-} select item in "${arr[@]}"; do result="${item}" [[ -n "${result}" ]] && break done echo "Result is ${result}" unset PS3 Directly using bash script.sh ,

jQuery dynamic added select

风流意气都作罢 提交于 2020-04-21 04:36:16
问题 When I add a select dynamic to a DIV via clone, I'm not able to select anything from the new dropdown, any ideas why? $(".inline-form .copyIng:first-child").clone().appendTo(".inline-form"); See this : http://jsfiddle.net/rxwL6/ .trigger("refresh"); Dosen't change anything, I still can't select anything from the new dropdown. 回答1: Problem is that you are cloning html content that has already been 'enhanced' by jQM and not the original markup. Therefore jQM does not know how to create or

Select default value of column MySQL

ε祈祈猫儿з 提交于 2020-04-18 12:54:44
问题 I will not go deep in details. I have Java program which is creating tables in Database. The thing is that when table is created one of the fields get default value. So when I am adding elements to this field I want to select default value. Now loading of all element's ID is: SELECT distinct(codeKind) FROM [table_name]; I want to be something like this: SELECT [default value of column codeKind] from [table_name]; I checked many of answer of other similiar questions but none of them is OK.

How to export or get LOCAL variables of a *ngFor loop OUTSIDE it in Angular (v9, Material)

流过昼夜 提交于 2020-04-17 22:53:52
问题 First steps in Angular (with Material at version 9). I'm creating a form with the following code: HTML: <mat-form-field> <mat-label>Course</mat-label> <mat-select [formControl]="subjectControl" [attr.data-tag-subjectSemester]="this.subjectControl.value ? this.subjectControl.value.trim() : '' [attr.data-tag-subjectName]="this.subjectControl.value ? this.subjectControl.value.trim() : '' (selectionChange)="onChange($event)" required > <mat-option>-- None --</mat-option> <mat-optgroup *ngFor="let

how to count timediff for each users mysql

最后都变了- 提交于 2020-04-17 22:50:47
问题 let's say i have the data table like this ID users_Id createdAt 1 12 '2020-01-01' 2 12 '2020-01-03' 3 12 '2020-01-06' 4 13 '2020-01-02' 5 13 '2020-01-03' how do i get the timediff for every transaction and every users so the results are just like this MAX MIN AVERAGE MEDIAN 3 1 3 3 explanation: the maximum of timediff happen in users_id 12 when '2020-01-03' until '2020-01-06' (3 days) the mininum of timediff happen in users_id 13 when transaction between '2020-01-02' and '2020-01-03' the