Vote count: 0 My knowledge of MySQL is basic. I want to build a query to retu all rows when is reached that sum a given amount value given value: 1.20 field to sum: amount order by expirydate table: id name expirydate amount 1 name1 11-08-16 0.20 2 name2 10-08-16 1.50 3 name3 08-08-16 1.00 I need the result from id 3,2 order by expiry date asked 23 secs agoJosef Let's block ads!...
ادامه مطلبVote count: 0 I'm trying to combine these 2 SQL queries. SELECT * FROM `history` WHERE `ID` = 56 SELECT * FROM `live` WHERE `ID` = 56 AND `ACTIVE` = 0 AND t1.`Shown` = 'complete' I've tried doing something like this: SELECT t1.*,t2.* FROM `history` t1 JOIN `live` t2 ON t1.`ID` = 56 AND t1.`ACTIVE` = 0 AND t1.`Shown` = 'complete' WHERE t2.`ID` = 56 But the query above results in selecting everything from live and forgetting about history. asked 28 secs agoFilip Let's block ads!...
ادامه مطلبVote count: 0 I am writing a query to count how many students each staff member supervises SELECT FACULTY.F_FIRST || ' ' || F_LAST AS STAFF,(COUNT(FACULTY.F_FIRST || ' ' || F_LAST)) as STUDENTCOUNT FROM STUDENT IER JOIN FACULTY ON STUDENT.F_ID=FACULTY.F_ID GROUP BY FACULTY.F_FIRST,FACULTY.F_LAST ; which correctly outputs Teresa Marx 3 Colin Langley 1 Joel Brown 1 Mark Zhulin 1 I now want to modify it so the query would only show the rows where the staff supervises the most students including mul...
ادامه مطلبVote count: 0 I know I can back up all the data of a database with mysqldump -uroot -pdbpasswd dbname > db.sql; And I can back up a specific table with where condition mysqldump -uroot -pdbpasswd dbname table_bame --where="date_column BETWEEN '2012-07-01 00:00:00' and '2012-12-01 00:00:00'" But how can I back up all the database where date between '2012-07-01 00:00:00' and '2012-12-01 00:00:00'. All the tables in my database has a date_time column and its type is timestamp type. Thanks! asked 1 ...
ادامه مطلبVote count: 0 I have a table Types that has the following columns: ID, Name, Type. The table is filled with about 300 rows. One of the rows: ID Name Type ------------------ 1 BMW S 1000 RR The following query retus this row: SELECT * FROM Types WHERE Name = 'BMW' However, the following query retus nothing: SELECT * FROM Types WHERE Type = 'S 1000 RR' There are no extra spaces in the Type, and the data types of Name and Type are exactly the same (varchar 255, utf8_unicode_ci). What can possibly c...
ادامه مطلبVote count: 0 I am using the following code $this->db->select('moduleId,actionId'); $this->db->from('role'); $this->db->where('roleId',$session_data['role']); $role=$this->db->get(); foreach ($role->result_array() as $rows) { $module=explode(":",$rows['moduleId']); $this->db->select('moduleId,moduleName,moduleUrl'); $this->db->from('module'); $this->db->where_in('moduleId',$module); $row=$this->db->get(); $result=$row->row_array(); } but only one row will come.how to get all the rows,please help...
ادامه مطلبVote count: 0 I'm looking for documentation about projects in OrientDB SQL syntax. I've seen various examples, but I'd like a comprehensive list. Examples of projections: SELECT out('my_edge') FROM Person SELECT expand(in('my_edge')) FROM Person SELECT max('my_field') FROM Person SELECT count(*) FROM Person There are obviously lots of other ones out there, but I'd love it if there were some complete syntax documentation for this somewhere. asked 36 secs agopdilyard This entry passed through the ...
ادامه مطلبVote count: -1 What is more efficient for finding and matching data values - querying all of the data in a table and iterating over it using a loop, for example: var rows = database.query("SELECT * FROM table"); for (var i = 0; i < rows.length; i++) { if (rows[i].column == "value") { console.log("value found"); } } or using the WHERE clause: SELECT * FROM table WHERE column='value' I am conceed that the iteration method might take longer than using the WHERE clause - am I correct? asked 2 mins a...
ادامه مطلب