Jump to content

Suggestion Needed


Baabu

Recommended Posts

create table Charger(
cid int not null auto_increment,
trademark varchar(20) not null,
type varchar(30) not null,
model varchar(30) not null,
unitprice int not null
primary key(cid));

well here is my sql for i want to view the entries which are made accroding to the date and the date format should be either view by date or view by month any ideas wat should i add to this table like which format of date and how to view it either by Group by or some other function?

Link to comment
Share on other sites

well as according to the table if it has records in this format how should i know or how should i add a button to my web page that view all the entires which were made on 21-12-2007 or what entries were made in 2 month just like this  :'(

Link to comment
Share on other sites

The table definition you gave does not have a field in which a date would be stored, so there's no hope of sorting anything/selecting anything based on a date criterion.

 

Add a field to your db-table. Set the type to date - that will default to the ISO standard date format of yyyy-mm-dd.  That's good as it allows you to make comparisons far more readily than any other date format.  When you display date information from the database, you can format the displayed date in any manner you want, by using the date() function ...

Link to comment
Share on other sites

well how can we use the function date() in our query if suppose we have a table  like

create table test(
datex date );

 

so can we use if we have some vales of datex

 

$query=select * from table order by date();

or anything like that

Link to comment
Share on other sites

SELECT * from db_table ORDER by datex ... datex is the fieldname, isn't it?  That will give you results ordered by date.  If you want sub-sets of that then use a typical WHERE syntax in your query and forget the ORDER, i.e. SELECT * from db_table WHERE datex = 'yourdatehere'

Link to comment
Share on other sites

I would reply to that if I had any idea what you just said.

 

When you are communicating with text as your medium, punctuation is a necessity so as to get your point across in a manner that people can understand. Especially when you are asking their help. Its impossible to help someone when you don't even know what it is they are asking.

Link to comment
Share on other sites

well it is also meaningless to posting a reply to that post which u are unable to understand this is what the way is other then putting a period it is much better to sit a side let the others go for it if they want rather then making the help method useless and always leave a hope for any one who is trying to learn do not tell them to go off the road. :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.