Jump to content

lordfa9

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by lordfa9

  1. lordfa9

    Change coloum name

    I need to change the column name of one of my tables for example ItemID ItemName1 Coffee changed to StockID StockName1 Coffee i need an SQL statement to do that, i want the name to be changed (instead of using an AS command)I was also reading something about using the ALTER TABLE and ALTER COLUMN commands, are these the correct command(s) to use and if so, how do i use them in a statement?
  2. i think what he means is to use MAX(taskid) for the select statement and to use a 'GROUP BY CustID'i'm not sure about the group by thing though, i think you have to use DISTINCT(CustID) in your select statement
  3. your answer is really going around me, seeing as that i don't really understand the terms you are using: open recordset load all the data into a dictionary first, and then iterate through the dictionary so do you mean that each coloum has its individual sql statement?
  4. i think you can try using WHERE here:select a,b,c,d,e,sum(f) from table WHERE X= bla blagroup by a,b,c,d,e, x having sum(f)>0"not sure if it works though, if not try removng the X from the group by clause
  5. I think you missed out on soemthing the phrase you want to use for the LIKE statement should have a * at the start and endTry this SELECT department FROM yourtablename WHERE item_name NOT LIKE "*Geo positioning system*"
  6. Ooo so its like such: SELECT Stock.Item, Stock.Itemname, Sum(Stock.QTY) AS TOTAL_QUANTITYFROM StockGROUP BY Stock.ITEM, Stock.Itemname; So this means that all the rows not using the aggregrate function has to be added to the group by?
  7. lordfa9

    INNER JOIN QN

    so you mean the code has to be like this?sql="SELECT Subcode, DateGiven, DateDue, Information & _FROM " & tblname & " & _Order BY " & sort & " " & ordering & "" & _
  8. lordfa9

    INNER JOIN QN

    recreated my file, seems to work now :)might be hardware or software though, i am now using a new platform.By the way, just a general query, when coding or coding general in notepad (Platform migration: Dreamweaver----> Notepad not good ). If i do the following to a piece of code will there be any difference? sql="SELECT Subcode, DateGiven, DateDue, Information FROM " & tblname & " Order BY " & sort & " " & ordering & "" typed in one complete line (notepad expands horizontally forever)or If i press enter to shift the various parts code to a new line eg. sql="SELECT Subcode, DateGiven, DateDue, Information FROM " & tblname & " Order BY " & sort & " " & ordering & "" will this affect the code? because i recall doing that before and it seems to cause a lot of funny errors, i didn't do it now and it seems alright
  9. I have the following tables, for simplicity I only include one row from eachLOCA ItemCode QtyFish 20 LOC B ItemCode QtyFish 30 Is there any way I can get the script to display as such: ItemCode LOCA LOCBFish 20 30 And so on and so forth for every extra item?
  10. I have the following SQL statementSELECT Stock.Itemcode, Sum(Stock.QTY) AS TOTAL_QUANTITYFROM StockGROUP BY Stock.Itemcode;This SQL works fine, however when I add itemname to the statement:SELECT Stock.Itemcode, Stock.Itemname, Sum(Stock.QTY) AS TOTAL_QUANTITYFROM StockGROUP BY Stock.ITEM; It gives me the error ‘You tried to execute a query that does not include the specified expression ‘itemname’ as part of an aggregate function’. Background: there may be more than one entry of the same item in the table (it’s a result of the merging of a few tables) and the first statement is to calculate the total number of each type of stock
  11. Let's say I have these two tables:LOC A Itemcode QtyFish 1Meat 3Eggs 4 LOC B Itemcode QtyFish 4Meat 3Eggs 1 How do I merge them together using a macro in Ms Access so that I get a table with the total of all the items? For example: Itemcode QtyFish 5Meat 6Eggs 5
  12. Do you have Macromedia Dreamweaver?if you do (and not to confuse you) its better to use a frameset.
  13. I made a change to the figures (in bold) it helps me to explain easierI then will try to explain what is written:what the paragraph says is that the code will generate a frame where the page is divided into two parts downwards (imagine a line running down your screen), the page on the left (taking up 25% of the screen) is the page frame_a.htm while the one on the right is frame_b.html. Both pages are displayed on your screen at the same time, sharing space.Anyway I think it's best to use dreamweaver to create a frame, it allows you to set the hight and width easily.
  14. just to add on, to submit data into the database you will have to use an INSERT statement, using the variablesMore info on how to submit variables can be found on the w3schools tutorial
  15. lordfa9

    search engine

    For example if you want to search for peppers in your "vegetables' table, your sql will be like thisSELECT * FROM vegetablesWHERE name LIKE "*peppers*"this will return red peppers, green peppers etc etcyou can substitute peppers for a user submitted value
  16. actually i really feel it depends on the situation that you are inif you want to do a couple of simple projects and never touch programming again, i really reccomend you learn ASp as w3schools can really provide everything you need and you can pick it up really fast if you are learning this as a longterm life skill then php is the way to go
  17. I don't really understand :/Are you trying to convert your [b]ID Name Ticket1 Ticket2 Ticket3[/b] 23 John 001 003 112 table to this format?-----> [b]NewID ID Name Ticket [/b] 1 23 John 001 2 23 John 003 3 23 John 112 I was also thnking that since you want to do a lottery, world it be better to use the random() function on the ticket number and then using a JOIN to find out who owns the winning ticket?
  18. I tried it and it didn't workI also noticed that you didn't use an inner join command, my database does not have any relationships so i think thats why it can't work.I was thinking, if i could use a sub query instead? For example to determine the quantity of fish that i have in LOCA, then submitting it where it will add that value to the number of fish in LOCB and give me a sum
  19. lordfa9

    INNER JOIN QN

    i'm quite sure it's not access because i ran the query there before using in in my script.As for error msg, i'm not sure cause i misplaced the file but i'll recreate it n get back to you, but i think it's something to do with being unable to excecute the query.
  20. Thanks for that answer!If the fish is spread over 3 locations, for example there are 3 tables, one for each location, is there any way i can link then all using an inner join? for example:SELECT SUM(Quantity) AS 'Number of Fish'FROM LOCA INNER JOIN LOCB ON LOCA.StockID=LOCB.StockID WHERE Stock = 'Fish' LOCA and LOCB are the tables for the two diferent locationsi need to find out how much fish i have in all locations
  21. lordfa9

    INNER JOIN QN

    I was just wondering if anybody else has a problem with using inner join in ASP cause whenever i use an inner JOin command in my SQL query it always dosn't work For example: <%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "c:/webdata/northwind.mdb"set rs=Server.CreateObject("ADODB.recordset")sql="SELECT Employees.NameFROM Employees INNER JOIN Orders ON Employees.Employee_ID=Orders.Employee_ID"rs.Open sql, conn%> is it my syntax?
  22. Ok lets say i have this tabeINVENTORY Stock Location QuantityFish A 2Fish B 3Fish C 4 How do i write an SQL statement to find out what is the total amount of fish i have in all locations?
  23. double check the calues in the top 2 $cfg lines, i think its not correct.a friend say that the address should be http://localhost, not sure bout it thoughdid you make any changes to config.inc.php? The root pw should be blank
  24. lordfa9

    i have a problem

    hmm i tried using inner join once for my SQL statement once but it didn't really work.Maybe you are better off combining the two tables together?
  25. lordfa9

    inset data

    i not really sure about the convert to excel part but if you are willing to use Ms Access as a go between (user types data into ASP form which is entered into Ms Access, whose tables you can convert to excel) u should read w3school's asp and ado tutorial 1st
×
×
  • Create New...