Forum Moderators: coopster & phranque

Message Too Old, No Replies

Anyone good with SQL here please help thanks

         

midi25

2:21 pm on May 23, 2002 (gmt 0)

10+ Year Member



Hi i am working my way through a book and it had a demo site for use in ultra dev. I have put in this SQL statement but it giving me a msg saying too few parameters expected 1. Here is the statement :

SELECT *
FROM Customers, Orders
WHERE Customers.CustomerID = Orders.CustomerID AND CustName = `CN`

what could be wrong with it please help thanks.

BTW its a recordsset that finds a customers order history.

ukgimp

3:12 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I dont think there is much wrong with the SQL appart from possibly not having a ';' at the end of the statement.

The other thing to look at are what you have called the fields in the database, do they match up exactly with your script and are they of the same datatype. I have messed around for ages before now only to find i have made a spelling error.

And remember in ultra dev you may need to re apply the recordset.

Xoc

4:08 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm suspicious about the quote marks. Those look like accent marks, not typical quotes.

midi25

4:18 pm on May 23, 2002 (gmt 0)

10+ Year Member



what are the correct marks??? i am new to SQL. I used the ` the key next to no.1 on a qwerty keyboard

Pushycat

4:24 pm on May 23, 2002 (gmt 0)

10+ Year Member



Hi. You need the unshifted key next to the return key. The one with ' and " on it.

Xoc

4:28 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld PushyCat. Right you are.

midi25

4:32 pm on May 23, 2002 (gmt 0)

10+ Year Member



next to my return key i have # then ' then ; if i shift them i get ~ then @ then :

Lisa

4:45 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If any of the fields are the same in the two tables you may have a problem. You are selecting *. So I am not sure if fields do share the same name but watch out there.

lorax

4:54 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



midi25,
Use the single quote key or a double quote - they share the same key.

And you may want to add parens around each of the = statements. It's a good habit to get into to avoid problems when you write more complex statements.

Pushycat

5:00 pm on May 23, 2002 (gmt 0)

10+ Year Member



If any of the fields are the same in the two tables you may have a problem. You are selecting *.

From my experience the only problem he/she will have is that duplicate column names will be assigned a sort of numeric column name. For example, column0, column1.. and so on.

An important point to make here, IMO, is that we should always strive to use column names in a query instead of just *.

lorax

5:28 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



we should always strive to use column names in a query instead of just *

I totally agree. It may not appear to be a big deal on a small db but try the two on a db with several thousand records and you're likely to notice a big difference in speed.

ergophobe

9:07 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Those look like accent marks, not typical quotes.

Actually, I think they are "backtick" marks and, yes, they make MySQL choke. For some reason, some "dump" programs use them and I always end up doing a search and replace. The key is (on a US keyboard), just to the left of the 1.

search for ` and replace with '

Tom

mole

10:15 pm on May 23, 2002 (gmt 0)

10+ Year Member



on a UK keyboard layout the ' is on the same keytop as the @

between the ; and the #