What is the purpose of "With" in a select statement?
463607
I know Transact-SQL, PL/SQL and MySQL, and none of them use WITH as a predicate or condition.\n\nThat said, in some programming languages, WITH is a way to add parameters to a given variable:\n\nDim objMail As New CDONTS.NewMail()\nWith objMail\n.To = "Someone@somewhere.com"\n.From = "me@myserver.com"\n.Subject = "Hello!"\n.BodyText = "Hi there!"\n.Send()\nEnd With
360031
While not used very commonly, a cross join is the foundation upon which inner joins are built. A cross join returns the cartesian product of the sets of rows from the joined tables.\n\nThe SQL code for a cross join lists the tables to be joined (FROM), but does not include any filtering predicate (WHERE).\n\nExample cross join (ANSI 92 standard syntax):\n\nSELECT *\nFROM employee CROSS JOIN \n     department;\nExample cross join (non-standard syntax):\n\nSELECT *FROM employee,department;\nExample results:\n\nLastName     DepartmentID    DepartmentName     DepartmentID \nSmith             34                     Sales                       31 \nSmith                   34                 Engineering                  33 \nSmith                   34                     Clerical                     34 \nSmith                   34                   Marketing                    35 \nJones                   33                      Sales                        31 \nJones                   33                   Engineering                  33 \nJones                    33                     Clerical                      34 \nJones                    33                   Marketing                     35 \n...16 more rows... \n\nAs you can see the cross join does no matching of like records. These joins are occasionally used to generate all possible combinations of records from tables that do not share a common element.
719576
One could use subqueries to solve this problem. If you are using SQL, u could try the following :- \n\nSELECT col1 from TABLE_A where col1 NOT IN (SELECT col2 from TABLE_B)\n\nNote - make sure col1 and col2 are compatible data types.
1018112
trying adding a distinct clause.  Select (distinct) from...  what's your query.
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?!
924206
to display the records from Sales table and Purchase table, do like Monalisa said, but he/she missing 'WHERE' query.\n\nassume :\nCreate Table Sales (Sales_Date date, total integer);\nCreate Table Purchase (Purchase_Date, total integer);\n\nSelect Sales_Date, Total from SALES where\nSales_Date>='10/03/2006' and Sales_Date<='10/09/2006'\nunion all\nSelect Purchase_Date, Total from PURCHASE where\nPurchase_Date>='10/03/2006' and Purchase_Date<='10/09/2006'\n\nNotes :\n'UNION' will eliminate the same records from PURCHASE table.\nto get all records we must use 'UNION ALL' .\n\nTo sum sales and purchase in 3rd to 9th oct  :\n\nSelect sum(A.Total) as TotalSales, sum(B.Total) as TotalPurchase from SALES as A, PURCHASE as B where A.Sales_Date>='10/03/2006' and A.Sales_Date<='10/09/2006'\nand B.Purchase_Date>='10/03/2006' and B.Purchase_Date<='10/09/2006'\n\nps :\nmy query format maybe have a little different with ms Access query format, so if my query can't run in ms Access, try to change it to ms Access query format.
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.
780343
If you are in VBA in MS Access? Than you can cut the string and used the variable directly and then finish the string.\n\nstudTbl.Open "SELECT * FROM [studlst] where ([no]=" & i &")"
1141994
Hi, It might be correct... Below is what I assume your code before the if statement.\n\nPreparedStatement ps = con.prepareStatement(\n"UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ? ");\nps.setInt(1, 75); \nps.setString(2, "Colombian"); \nint n = ps.executeUpdate():\n\nNote that when the return value for executeUpdate  is 0 , it can mean one of two things: (1) the statement executed was an update statement that affected zero rows, or (2) the statement executed was a DDL statement. \n\nIt doesn't necessarily mean it has failed, it might mean nothing has changed. Check if your properties of your sql syntax is correct. Because everything upto here is correct. But 0 can mean two stuff as I mentioned above.\n\nTake care
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
565802
If you use INSERT INTO and do not set a value for the description feild the default "NO DESCRIPTION" that you set will appear in the column.\n\nYes, as the first person said, you can't use INSERT INTO and set the value of description to NULL because you have set the column to not allow NULL
1045597
you must get current value of row spli it with ', ' and insert 2 section or more of rows another time to table .therefore need to 3 functon :\nget - split - update(or insert)
978704
You use limit in conjunction with 1 or 2 numbers. If you use 1 number like this:\n\nselect * from myTable limit 5;\n\nthen MySQL will grab the first 5 results from the table. However, if you use if like this:\n\nselect * from myTable limit 5,5;\n\nthen MySQL will grab 5 results, starting from record number 5. So it's\n\nlimit [startPos], [numberOfRecords]\n\nEnjoy -
247609
It's probably an overview of a database's functionality and usefulness, taking into account the entity relationships (records, fields, tables, etc.), ability and availability of meaningful queries, and use of proper datatypes, amongst other things.\n\nIt's a good idea to ask yourself all kinds of questions regarding what you want the database to do for you and any (other) users, develop the necessary tables, and test out a few queries.
1105416
I would never use a column name with a parenthesis in it, so I think you should change that first.\n\nJust call the column name instead....like select 1 from table etc...if its in column 1.
1002503
I hate the darn things. I have one in my name and it's a real pain.\n\nApplications written in SQL have a real problem with them too and usually error out if you include one.\n\n\nOther than that it's just plain lazy.
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.