how to make a pivot query in oracle?
101475
Tom Kite has an Ask Tom Site that has a full explaination.\n\nSee => http://asktom.oracle.com/pls/ask/f?p=4950:8:17396113213697957489::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:766825833740
840445
From what it looks like you want to do, I don't think you even need the GROUP BY clause. You probably want something like:\n\nSELECT t4_key, year, season, month, day\nFROM rw_top40\nWHERE year = 97 AND season = '2 - summer'\nORDER BY t4_key, year, season, month, day;\n\nAnyway, the GROUP BY clause has to come AFTER the WHERE clause, like this:\n\nSELECT t4_key, count(*)\nFROM rw_top40\nWHERE year = 97\nGROUP BY t4_key
880002
Do u mean SQL?\n\nuse :\n------------------------- Syntax ----------------------------\nUPDATE <table_name> set <column_name> = Formula\n------------------------- Syntax ----------------------------\n\nHere formula can contain the name of column being edited itself or other columns or any other expression as per requirement.\n\nEnjoy and all the best.
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.
886601
Choose Tools>Customize \nSelect the Data category on the Commands tab \nNear the end of the commands list, select Generate GetPivotData \nDrag the command to one of your toolbars \nClick Close  \nClick the Generate GetPivotData button to toggle this feature on and off
687215
Select NAME THE FIELD AND CONDITION\nFrom NAME THE TABLE\n\nUNION (This is the operator to combine tables in SQL)\n\nSelect NAME THE FIELD AND CONDITION\nFrom NAME THE TABLE;
1062183
We're going to call your row "numbers" and your table "table" for this example.  The SQL code would look like this:\n\nSELECT SUM(numbers)\n   FROM table;\n\nThere you go.
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.
362803
You should add more details ... your field names, table name, database type (e.g. Access, Informix) etc.\n\nThe code below assumes your database is MS SQL Server\n\nSELECT AmtPaid, Firm_Number AS [Firm#],Payment_Date As DatePaid,Payment_Number As [Payment#]\nFROM Payments\nWHERE (DatePaid >= '2005-06-01' AND  DatePaid <= '2005-06-10') AND Firm_Number = 1115
125012
If you know that the column name exists in the table that is used in the query, then possibly the column that you are comparing is a CHAR type of column.  In that case, make sure that you surround the data with single quotes.\n\nSELECT * FROM SomeCharTable WHERE SomeColumn='ABC123'\n\nThe above should work for a column that is a CHAR type column.  It is important to put the single quote (') around the text.  Note, in the example above, "SomeColumn" must be a column that exists in the table "SomeCharTable".
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;
250883
Depends on the type of query you want.\n\nYou can use a UNION if your tables all have the same number, types and names of columns:\n\nSELECT name, age, address FROM table1\nUNION ALL\nSELECT name, age, address from table2\n\nOr, you can use a left join if you want all the columns from table1, but only columns from table2 that match on a key:\n\nSELECT a.*, b.name, b.age FROM table1 a LEFT JOIN table2 b ON a.record_id = b.record_id\n\nOr, you can use a inner join if you only want columns from both tables if there are key matches in both tables:\n\nSELECT a.*, b.name, b.age FROM table1 a INNER JOIN table2 b ON a.record_id = b.record_id\n\nAnd you can do this with multiple tables:\n\nSELECT a.*, b.name, b.age, c.height, d.favoritecolor, e.GPA FROM table1 a LEFT JOIN table2 b ON a.record_id = b.record_id LEFT JOIN table3 c ON a.record_id = c.record_id LEFT JOIN table4 d ON b.some_key = d.record_id LEFT JOIN table5 e ON (a.another_key = e.yet_another_key AND e.GPA > 3 AND a.fourth_key = e.fifth_key) WHERE a.record_id > 100 and c.height < 145
254134
I believe Access SQL supports the TOP keyword as below.  This will allow you to easily limit the number of records.\n\nSelect TOP field1, field2, field3\nfrom mytable1 m1 left join mytable2 m2\n on m1.field1 = m2.field4\nwhere field1 = 'value'
455478
Create a query and paste this into it's SQL sheet:\n\nSELECT tblData.TICKER, tblData.DATE, tblData.CLOSE, (SELECT Sum([CLOSE])/Count([ticker]) AS Expr1 FROM tblData AS sub WHERE \n(((sub.TICKER)=[tblData]![Ticker]) AND ((sub.DATE) Between [tbldata]![date]-19 And [tbldata]![date]));) AS avg20 FROM tblData;\n\nIt will show the 20-day average for each stock for each date, but if there are fewer days of data available for a stock, it will show a real average for those days.\n\nI don't know what's causing the "..." in the middle of the SQL, but just replace it with "er]) "\n\nThis is what's called a Subquery
461228
http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=58
1124819
Create a new field in the property table called Address:\n\nalter table property add Address char(50);\n\nThe above assumes the data type is char(50).\n\nUpdate that new field equal to street number and street name:\n\nupdate property set Address = concat (Street_Num, ' ', Street_Name);\n\nAssumes that Street_Num and Street_Name represents street number and street name, respectively.\n\nThis assumes MySQL syntax.  The exact concatenate syntax is database-dependent.
477569
try this query: select count(*) from tablename\nit will returns 73421.