hello @LL is it possible to make a query like this? - providing names of table1 & table2. - display data from table1 where userID in table1 is the same as userID in table2 ? is this possible ? Thanks
You can use a join to do this easily. Assuming you're using mysql. SELECT * FROM table1 INNER JOIN table2 ON table1.userID = table2.userID; If you are using a different database, the syntax may be different. Also if you need to select specific columns you need to format it like this. SELECT table1.name, table2.address, etc... FROM table1 INNER JOIN table2 ON table1.userID = table2.userID;
thanks i got this by using this: SELECT `first`, `last`, `street1`, `street2`, `city`, `state`, `zip`, `emailAdr` FROM `table1`, `table2` WHERE table1.userID = table2.userID Code (markup): what about if I want to do another query based on the result of that one? is it possible?
Can you explain what you are trying to accomplish with a second query based on the results from the above query? It may be possible, it just depends on what you are trying to do. Also, you should specify the table name for the specific column you are retrieving. This makes selecting from joins quicker. Also, if more than one table has a column with the same name, you will get an ambiguous error when querying with a join. Use `table1`.`first` instead of `first`