How do I write a query in SQL with the parameters, Displaying the AmtPaid, Firm#, DatePaid, and Payment#.?
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
637006
SELECT MAX(Sno), Name FROM Temp GROUP BY Name \n\nyou have to include the GROUP BY clause when using any of the group functions (MAX(), MIN(), SUM(), etc) so the database knows how to relate the data in the other columns to determine the groups.
1082818
Please note for any of this to work you have to have the project references include the Microsoft ActiveX Data Objects library\n\ndim conn as new ADODB.Connection\ndim rs as new ADODB.Recordset\n\n'Tell your connection what and how to connect\nconn.ConnectionString= "DSN=DSNname;UID=SqlServerUserID;pwd=SqlServerPassword"\n\n'open the connection\nconn.open\n\n'Run your SQL Query\nset rs = conn.Execute("Select * from datatable")\n\n'See if any records were returned we do this\n'by seeing if the recordset is simoultaneously reporting\n'that it is at the beginning and end of the record set\nif not rs.EOF and not rs.BOF then\n\n\n     'Get the field by field name\n      myValue=rs("fieldName")\n\n     'Get the field by position in the return set\n     'This is a zero baed index\n      mySecondValue= rs(3)\n\n     'Now I move to the next record. \n     rs.MoveNext\n\n     if not rs.EOF then\n          'Get another value\n           myValue=rs("FieldName")\n     end if\n\nend if\n\n'now close and clean up\n\nconn.Close\nset rs = nothing\nset conn=nothing
216311
Check the links below: The first link may not work but the second link will bring you to the maptech search page where you can enter the parameters. Good luck!
1011647
My coldfusion is pretty rusty (php guy now) but the first question that comes to mind is, rather than use 2 seperate queries, why not use one?\n\nTry SELECT * .... etc\n\nWHERE order_ID = (SELECT MAX(order_ID) FROM Orders)\nORDER BY ... etc.\n\nThis is called a subquery or correlated subquery.  Most SQL databases support the idea.
1023038
The file structure looks pretty close to what you would want.  Have a table with EmployeeId (PK), ManagerId (nullable), name, etc etc..  Then create a check constraint on the ManagerId field to ensure that a value exists inside of employees table already (except when null).  If you then want to have two different queryable objects you could create a view like ManagerEmployeeView and PeonEmployeeView =)
774615
I found this for you : http://www.databasejournal.com/features/mssql/article.php/1756161\n\nHope that helps! Sounds like fun!
578061
Supposing the following:\n1. You're table name is tblInventory\n2. You're product code is called ProdCode\n3. You have a field called [SoldQty]\n4. You're on a form that has a field called "QtyPurchased"\n5. You're form has a field that contains the ProdCode for the item you sold...\n\nOnce the sale is complete you can do:\n\nDoCmd.RunSql "update tblInventory set [SoldQty]=[SoldQty]+" & me.QtyPurchased where ProdCode=" & me.ProdCode
870873
Well the easiest way is to use a straight out SQL method in access. Its not that a SQL method is hard but is just how you access the information in a table. Below is a link to a page which shows you a great straight forward example of using a few nested select statements or if you want to create an intermediate table to hold the results, that example is there too.\n\nHope this doesn't confuse you too much, but really if you take a look at it, you will find it makes sense. Just read it out loud.\n\nGood luck!
967929
Best way is to have 2 tables.  A header and details table.\n\nThe header table will have one row per sale.  Key field would be invoice number.\n\nThe detail table will have details of each sale.  One row per item.  Key field would be invoice number and item number\n\nJoin field would be invoice number.
750784
OpenOffice has a forum where you can put your query... they shall be able to help you out.... quickly.
344140
I previously answered this question for you, but I'll answer it again.\n\nYou will use UNION to join your two queries together, since you are getting the same number of columns from both queries.\n\nSELECT * FROM table WHERE PATINDEX('%$%', datepricecolumn) > 0 ORDER BY datepricecolumn\nUNION\nSELECT * FROM table ORDER BY datepricecolumn\n\nWhere:\n\ntable is the name of your table\ndatepricecolumn is the name of the column that contains the dates and prices.
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;
1071667
I think u have to enter you host name, username password and the name of the database after the =>.\n\nyou can do this wich a text editor like notepad.
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?>
998788
I've code for this somewhere, - I'll try to find it for you.\n\nThe code below is for a custom function, not t-SQL. Hope this helps.\n***\nSET QUOTED_IDENTIFIER ON \nGO\nSET ANSI_NULLS ON \nGO\n\nALTER       function Num2Words(@s varChar(50), @Desc2Num char(8))\n\nreturns varChar(1024)\nas\nbegin\n/*\n   English words for numbers\n   valType is '' or dollars,Money,$, Percent, %\n   this function will take in some type of value, - and return back\n   the number is english script format, such as:\n    $4.22  = Four dollars 22/100 cents\n   given the 2nd parameter of '' or '$' or '%' it will be used\n   to fomat the number in question.\n  \n   if in fact, the number has a $ or a %, then that format will come\n   thru with the number. If the value is not numeric, - then the original\n   value will just be returned.\n*/\ndeclare @a char(1), @b char(1), @c char(1), @i int, @j int, @result varChar(1024), @orlen int\ndeclare @cents int, @negative varChar(9)\n\nif @s is null begin return '0 dollars and no cents' end\nset @Desc2Num = lower(@Desc2Num)\nset @Desc2Num = case rtrim(@Desc2Num)\n when 'money' then ' dollars'\n when 'dollars' then ' dollars'\n when 'dollar' then ' dollars'\n when '$' then ' dollars'\n when 'percent' then ' percent'\n when '%' then ' percent'\n when '' then ' '\n else ' '\n end\n\nset @s = replace(@s,',','')\n\nif charindex('$',@s) > 0\n begin\n  set @Desc2Num = ' dollars'\n  set @s = replace(@s,'$','')\n end\nif charindex('%',@s) > 0\n begin\n  set @Desc2Num = ' percent'\n  set @s = replace(@s,'%','')\n end\nset @s = replace(@s,' ','')\n\nif isnumeric(@s) <> 1 begin return @s end\nset @negative = ''\nif cast(@s as dec(10,2)) < 0\n begin\n  set @negative = 'Negative '\n  set @s = replace(@s,'-','')\n end\n\nif @Desc2Num = ' percent' and cast(@s as dec(10,2)) < 1\n begin\n set @s = cast(cast(@s as dec(10,2)) * 100 as varChar(50))\n set @s = left(@s,len(@s) - 3)\n end\nif @Desc2Num <> ' percent'\n begin\n set @cents = (cast(@s as dec(10,2)) - ROUND(cast(@s as dec(10,2)), 0, 1)) * 100\n set @s = cast(ROUND(cast(@s as dec(10,2)), 0, 1) as varChar(50))\n set @s = left(@s,len(@s) - 3)\n end\n\nset @orlen=len(@s)\nif len(@s) % 3>0\n set @s=' '+@S\nif len(@s) % 3>0\n set @s=' '+@S\nset @i=1 set @result=''\nif len(@s)=1 AND @s='0' \n set @result='zero'\n\nwhile @i<=len(@s)\n begin\n set @j=len(@s)-@i+1\n set @a=substring(@s,@j,1)\n set @b=substring(@s,@j-1,1)\n set @c=substring(@s,@j-2,1)\n if isnumeric(@a)=1\n  begin\n  set @result=case \n   when (@i-1=3) AND (@c+@b+@a<>'000') then 'thousand'\n   when (@i-1=6) AND (@c+@b+@a<>'000')  then 'million'\n   when (@i-1=9) AND (@c+@b+@a<>'000')  then 'billion'\n   when (@i-1=12) AND (@c+@b+@a<>'000')  then 'trillion'\n   when (@i-1=15) AND (@c+@b+@a<>'000')  then 'quadrillion'\n   when (@i-1=18) AND (@c+@b+@a<>'000')  then 'quintillion'\n   when (@i-1=21) AND (@c+@b+@a<>'000')  then 'sextillion'\n   when (@i-1=24) AND (@c+@b+@a<>'000')  then 'septillion'\n   when (@i-1=27) AND (@c+@b+@a<>'000')  then 'octillion'\n   when (@i-1=30)  AND (@c+@b+@a<>'000') then 'nonillion'\n   when (@i-1=33) AND (@c+@b+@a<>'000')  then 'decillion'\n   when (@i-1=36) AND (@c+@b+@a<>'000')  then 'undecillion'\n   when (@i-1=39) AND (@c+@b+@a<>'000')  then 'duodecillion'\n   when (@i-1=42) AND (@c+@b+@a<>'000')  then 'trede
437824
If you have the ability to enter a direct SQL statement into UltraDev when you are binding this data, your SQL statement would look something like this:\n\nSELECT a.*, b.* FROM troubleshootingtable a INNER JOIN servertable b ON a.servernamecolumn = b.servernamecolumn WHERE a.recordidcolumn= 'recordid'\n\nIn the statement above:\n\nReplace "troubleshootingtable" with the name of the troubleshooting table\n\nReplace "servertable" with the name of the table that holds your server info\n\nReplace "servernamecolumn" with the names of the columns that hold your server names. For example, if that's called server in the troubleshooting table, then a.servernamecolumn would be changed to a.server; if it's called servername in the servers table, you'd change b.servernamecolumn to b.servername\n\nReplace "recordidcolumn" with the name of the primary key column in your troubleshooting table.\n\nReplace "recordid" with the name of the variable you will be using to get the right record.\n\nIf this doesn't help, follow up and I will try to clarify.