hi everyone, i need help on a sql query. consider a table weather containing a column city. suppose i have two rows with data in the city column as 'new delhi' and the second as 'new whatever'. so to select one row with say 'new delhi' i would give the following sql command SELECT * FROM weather WHERE city = 'new delhi';
what is the query if i want to select all rows with 'new' as a pat of the string in the city column? in this case both the above rows should be returned
thanks rahul.
hii
this should work for u
SELECT * FROM weather WHERE city LIKE 'new%'
hope that was useful
Nikhil
----- Original Message ----- From: "rahul revo" rrevo@softhome.net To: "linux mail list" linuxers@mm.ilug-bom.org.in Sent: Saturday, October 11, 2003 3:28 PM Subject: [ILUG-BOM]sql query help
Next LUG meet: 12 Oct 2003 around 4 pm - VJTI Computer Centre
hi everyone, i need help on a sql query. consider a table weather containing a column city. suppose i have two rows with data in the city column as 'new delhi' and the second as 'new whatever'. so to select one row with say 'new delhi' i would give the following sql command SELECT * FROM weather WHERE city = 'new delhi';
what is the query if i want to select all rows with 'new' as a pat of the string in the city column? in this case both the above rows should be returned
thanks rahul.
Sometime Today, rahul revo assembled some asciibets to say:
i need help on a sql query.
you should maybe get a book.
what is the query if i want to select all rows with 'new' as a pat of the string in the city column? in this case both the above rows should
This is a very basic SQL statement, something you'd learn at the beginner's level. You need to look at SQL wildcards. Get a book and read it.
Rahul,
Try SELECT * FROM weather WHERE city like '%new%';
Regards, Prashant
rahul revo rrevo@softhome.net wrote: Next LUG meet: 12 Oct 2003 around 4 pm - VJTI Computer Centre ------------------------------------------------------------- hi everyone, i need help on a sql query. consider a table weather containing a column city. suppose i have two rows with data in the city column as 'new delhi' and the second as 'new whatever'. so to select one row with say 'new delhi' i would give the following sql command SELECT * FROM weather WHERE city = 'new delhi';
what is the query if i want to select all rows with 'new' as a pat of the string in the city column? in this case both the above rows should be returned
thanks rahul.