what does "group by" does exactly in mysql?!!?
149819
The GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns.\n\nThe syntax for the GROUP BY clause is:\n\nSELECT column1, column2, ... column_n, aggregate_function (expression)\nFROM tables\nWHERE predicates\nGROUP BY column1, column2, ... column_n;\n\naggregate_function can be a function such as SUM, COUNT, MIN, or MAX.\n\n\n\nExample using the SUM function\nFor example, you could also use the SUM function to return the name of the department and the total sales (in the associated department).\n\nSELECT department, SUM(sales) as "Total sales"\nFROM order_details\nGROUP BY department;
1018112
trying adding a distinct clause.  Select (distinct) from...  what's your query.
393030
See the reference below.  The documentation has some examples. \nFailing that MySQL has a C API which you could use from C++.
224715
Select * from (SELECT DepID, AVG(Salary), SUM(Salary), Count(EmpID) from EmpTable Group By DepID) MyTable Where RowNum<=5 order by RowNum;\n\nPL/SQL\n\nDECLARE\nCURSOR MYCUR IS SELECT * FROM (SELECT DEPID, AVG(SALARY), SUM(SALARY), COUNT(EMPID) FROM EMPTABLE GROUP BY DEPID) MYTABLE WHERE ROWNUM<=5 ORDER BY ROWNUM;\nTHISDEPID NUMBER(10);\nTHISAVGSALARY NUMBER(10);\nTHISSUMSALARY NUMBER(10);\nTHISCOUNTEMP NUMBER(10);\nBEGIN\n   OPEN MYCUR;\n   LOOP\n      FETCH MYCUR INTO THISDEPID, THISAVGSALARY, THISSUMSALARY, THISCOUNTEMP;\n      EXIT WHEN MYCUR%NOTFOUND; \n   END LOOP;\n   CLOSE MYCUR;\nEND;
804616
Are you getting an error? Is the field comp_it or comp_id?\n\nwrite gsSQL to the browser and see if it is generating your select statement correctly. also, why do you have gsSQL = ""?\nRather have it as follows: gsSQL = "Select * FROM complaint WHERE comp_id = " & incmp\n\nunless you have a valid reason?!
743722
Hello,\nThe inner query, which is\n\nSELECT [Employee Information].FirstName, [Employee Information].LastName, Courses.CourseTitle, CoursesCompleted.CourseID\nFROM Courses INNER JOIN ([Employee Information] INNER JOIN CoursesCompleted ON [Employee Information].StudentID=Courses... ON Courses.CourseID=CoursesComple...\nWHERE (((CoursesCompleted.CourseID)=... THE COURSE NUMBER])))\n\nreturns a set of first names, last names, course titles and course id numbers; however you are checking whether >only< the first name and the last name of a particular employee is in that set. If I'm not mistaken, both sides of the 'NOT IN' clause should contain the same information. In this example, one side (outer query) contains the name of the employee, and the other side (inner query) contains the name of the employee + course information. \nTry this: in the second query select only the first and last name of the employee (not the course info) but keep the joins in the FROM clause.\n\nIf I had designed the tables, I would assign a unique id to each employee, just as courses have their unique course ids. It would have eased this task a lot.\n\nI know I sound confusing, but hope it helps
1132129
Read this short review:\nhttp://en.wikipedia.org/wiki/DBMS
901854
A simple SELECT statement is the most basic way to query multiple tables. You can call more than one table in the FROM clause to combine results from multiple tables. Here’s an example of how this works:\nSELECT table1.column1, table2.column2 FROM table1, table2 WHERE table1.column1 = table2.column1; \n\nIn this example, I used dot notation (table1.column1) to specify which table the column came from. If the column in question only appears in one of the referenced tables, you don’t need to include the fully qualified name, but it may be useful to do so for readability. \n\nTables are separated in the FROM clause by commas. You can include as many tables as needed, although some databases have a limit to what they can efficiently handle before introducing a formal JOIN statement, which is described below. \n\nThis syntax is, in effect, a simple INNER JOIN. Some databases treat it exactly the same as an explicit JOIN. The WHERE clause tells the database which fields to correlate, and it returns results as if the tables listed were combined into a single table based on the provided conditions. It’s worth noting that your conditions for comparison don’t have to be the same columns you return as your result set. In the example above, table1.column1 and table2.column1 are used to combine the tables, but table2.column2 is returned. \n\nYou can extend this functionality to more than two tables using AND keywords in the WHERE clause. You can also use such a combination of tables to restrict your results without actually returning columns from every table. In the example below, table3 is matched up with table1, but I haven’t returned anything from table3 for display. I’ve merely checked to make sure the relevant column from table1 exists in table3. Note that table3 needs to be referenced in the FROM clause for this example.\nSELECT table1.column1, table2.column2 FROM table1, table2, table3 WHERE table1.column1 = table2.column1 AND table1.column1 = table3.column1;\n\nBe warned, however, that this method of querying multiple tables is effectively an implied JOIN. Your database may handle things differently, depending on the optimisation engine it uses. Also, neglecting to define the nature of the correlation with a WHERE clause can give you undesirable results, such as returning the rogue field in a column associated with every possible result from the rest of the query, as in a CROSS JOIN. \nIf you’re comfortable with how your database handles this type of statement, and you’re combining two or just a few tables, a simple SELECT statement will meet your needs.
847711
I'm not sure I completely understand your question, but it looks as if you are trying to implement a primary column that will automatically increment.\n\nIn MS SQL Server, this is done using identity specification. Read the following for more information:\n\nhttp://www.dbazine.com/sql/sql-articles/charran7
742763
Go to the MySQL site, they have the best documentation there under the documentation section.  Here's the link:\nhttp://dev.mysql.com/doc/
692712
The best way to do this is to create a query that concatinates the two fields (assuming that the title of the column and the data in each row is the same). To do this you need to created a new Primary Key on your output table which contains both the columns from the two different tables (this is known as a compound key).\n\nHope this helps.
99695
What do you mean?\nMaybe "SQL command with two criteria?"?\n\nIn this case if you mean the condition "WHERE" you joint each condition with "AND".\nExample:"SELECT * FROM table WHERE field0 = 'value0' AND field1 = 'value1';"
1059497
Select * from employee_master_table where employee_name like '%%entered_employee_name%%'\n\ncheers !!!!\n\nHello Mate,\n\nI program in PHP. below is a sample code form PHP, maybe this would be of some help to you.\n\n<?\n\n\n$user="ISAdmin";\n@$password="********";\n@$database="my_DB";\n@mysql_connect(localhost,$user,$password) or die ("could not connect to database");\n@mysql_select_db($database);\n\n$query = "select * from my_DB";\n\n$result = mysql_query($query);\n\n$num=mysql_numrows($result);\n\necho "<p>$num records found!!!!";\n\n$i=0;\nwhile ($i < $num) \n\n{\n\n$tmpid=mysql_result($result,$i,"dataid");\n/*($result,$i,"dataid")\n$tmpname=mysql_result($result,$i,"databname");\n/*($result,$i,"databname")\n\n$savetofile=  "<p><a href=&#92;"index.php?transtype=$transid&data=$tmpid&#92;"> $tmpid   $tmpname </a>";\n\necho $savetofile;\n\n$i++;\n\n}\n\n\n$delthis = $_GET['data'];\n\nif($delthis<>"")\n{\n\n\n$query = "select from my_DB where dataid=&#92;"$delthis&#92;"";\n\n$tmpid=mysql_result($result,$i,"dataid");\n\n$tmpname=mysql_result($result,$i,"databname");\n\n\n<form>\n<input type= text" name="text1" value="<?echo $tmpid?>"?\n<input type= text" name="text2" value="<?echo $tmpname?>"?\n</form>\n\n@mysql_close();\n}\n\n?>
879067
Use mySQL and secure it. Plus, once it is set up you can manipulate it so much easier.
777696
Well, that's one of the first questions i asked when i worked with value sets in oracle applications.. The answer is no way.. you cannot make a distinct select out of value set..\nThere is a work arround though, you can create a veiw with the required data, and then add the distinct keyword to it.. When you create the value set, choose this view and add it's columns and conditions if any.. I'll be glad to go further with that if needed\n\n\nThanks
428028
An extended example:\n\nSELECT * FROM MYTABLE ORDER BY date,price
1060571
Do you get an exception error?\n \nI would need to see the SQL statement to see what is wrong with it. If it is executing the query, but you dont see the changes, then there is something wrong with the SQL statement.